Books for Enyo 2 (Pane replacement)

edited March 2012 in Enyo 2
After realizing that there's currently no way to get Pane-like behavior in Enyo 2, I went out and made my own quick Pane replacement, called Books.

Download: https://github.com/villo/User-Portal/blob/master/source/book/book.js

Books works very similar to Panes. First, you create your Books container:
{kind: "Book"}

Now you can add anything into the components block:
{kind: "Book", components: [
    {name: "pageOne", content: "Hello"},
    {name: "pageTwo", content: "Oh, why you changed the page!"}
]}
The first component in the components block is visible when the book loads. You can change the visible book using the pageName method:

this.$.book.pageName("pageTwo");

Additionally, you can use the pageNumber method to change pages.

Books also somewhat supports lazy pages:

{name: "somePage", kind: "thePageContent", lazy: true}

However, using lazy pages is highly experimental, and may not work. Additionally, if you wish to call a lazy page, you must use the pageName function, as pageNumber will not work.

If you have any questions, feel free to let me know.

Comments

Sign In or Register to comment.