npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

webix-state-renderer

v1.0.2

Published

## Usage

Downloads

2

Readme

webix-state-renderer

Usage

Basic example:

webix.ready(function () {

    var stateRenderer = webixStateRenderer(webix);
    var stateRouter = abstractStateRouter(stateRenderer, document.body);

    stateRouter.addState({
        name: 'app',
        template: {
            rows: [
                {
                    type: "header", template: "My App!"
                },
                {
                    height: '100%',
                    cols: [
                        {
                            type: 'toolbar', css: 'menu_button',
                            rows: [
                                {
                                    view: "button", label: "Page 1", width: 100, click: function () {
                                    stateRouter.go('app.page1')
                                }
                                },
                                {
                                    view: "button", label: "Page 2", width: 100, click: function () {
                                    stateRouter.go('app.page2')
                                }
                                }
                            ]
                        },
                        {$subview: true}
                    ]
                }
            ]
        },
        route: '/app'
    });

    stateRouter.addState({
        name: 'app.page1',
        template: {
            template: 'Page1 content'
        },
        route: '/page1'
    })
    ;

    stateRouter.addState({
        name: 'app.page2',
        template: {
            template: 'Page2 content'
        },
        route: '/page2'
    });

    stateRouter.evaluateCurrentRoute('app.page1');
});

Installation

npm + your favorite CommonJS bundler is easiest.

npm install webix-state-renderer

You can also download the [https://wzrd.in/standalone/webix-state-renderer@latest](stand-alone build from wzrd.in). If you include it in a <script> tag, a webixStateRouter function will be available on the global scope.

Features

See full https://github.com/TehShrike/abstract-state-router list of router features.

Component declaration

Component style:

stateRouter.addState({
    name: 'app.page1',
    template: {
        $ui: {rows: [...]},
        $oninit: function (view, scope) {
            webix.message('initialized page1');
        },
        $ondestroy: function () {
            webix.message('destroying page1');
        }
    },
    route: '/page1'
});

Template first style:

stateRouter.addState({
    name: 'app.page1',
    template: {
        rows: [...],
        $oninit: function (view, scope) {
            webix.message('initialized page1');
        },
        $ondestroy: function () {
            webix.message('destroying page1');
        }
    },
    route: '/page1'
});

Lifecycle

There are two kinds of component lifecycle - routes and component. For routes lifecycle find documentation here: https://github.com/TehShrike/abstract-state-router#state-change-flow

Webix components have following lifecycle methods:

  • $oninit - called after view has been rendered into component
  • $ondestroy - called before view will be destroyed

Comparison to webix-jet

Tandem webix-state-router-renderer and abstract-state-router covers most of the cases introduced by the webix-jet project. In fact this project is highly inspired by the webix-jet. Why then another project?

webix-state-router-renderer is driven by the angular like router practices which I find one of the best for such cases. The thing I don't like very much about webix-jet is that it relies highly on AMD module system and the project file structure. Each partial routes are corresponding AMD resource which I find very dangerous n term of security and not extensible.

In the other hand webix-jet project is maintained by the webix team which make it very reliable, also it has very good documentation https://webix.gitbooks.io/webix-jet and has few more features regarding scope which in the future might be covered by the webix-state-router-renderer as well.