yog-bigpipe
    DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/yog-bigpipe package

    0.4.0 • Public • Published

    yog-bigpipe

    Build Status Coverage Status

    An express.js middleware for fis widget pipline output.

    This middleware is bundled in yog.

    With yog you can simple use the pagelet like this.

    {% extends './layout.tpl' %}
     
    {% block content %}
        {% widget "./pagelets/jumbotron/jumbotron.tpl" id="jumbotron" mode="async" %}
    {% endblock %}
     

    And in your controller, you can assign async data like this.

     
    router.get('/', function(req, res) {
     
        // pagelet Id
        res.bigpipe.bind('jumbotron', function(setter) {
     
            // simulate an async progress
            setTimeout(function() {
                
                // now set data to the pagelet
                setter(null, {
                    asyncData: 'xxx'
                });
            }, 2000);
        });
     
        res.render('page/index.tpl');
    });
     

    Then the jumbotron content will be rendered in chunk mode.

    Install

    npm i yog-bigpipe

    DownloadsWeekly Downloads

    90

    Version

    0.4.0

    License

    MIT

    Last publish

    Collaborators

    • 2betop
    • fansekey
    • zhangtao07
    • hefangshi