Notorious Penguin Magicians

    unshift

    0.0.0 • Public • Published
    'use strict';
     
    var unshift = require('unshift');
     
    unshift
      .transport('jsonp', unshift.jsonp)
      .transport('flash', unshift.flash)
      .transport('xhr', unshift.xhr)
      .transport('event-source', unshift.eventsource)
      .transport('custom', require('custom-transport'))
      .transport('websocket', unshift.websocket);
     
    unshift.transform('incoming', function incoming(msg, next) {
      setTimeout(function timeout() {
        msg.data = 'foo';
        next(undefined, false);
      });
    });
     
    unshift.transform('incoming', 'event', function incoming(msg) {
      delete msg.data;
      return false;
    });
     
    unshift.on('event', function event(msg) {
      console.log(msg);
    });
     
    unshift.listen(8080);

    If this excites you, and you want to contribute. You know where to find me.

    Keywords

    Install

    npm i unshift

    DownloadsWeekly Downloads

    1

    Version

    0.0.0

    License

    MIT

    Last publish

    Collaborators

    • unshiftio
    • v1
    • 3rdeden