Skip to content

Instantly share code, notes, and snippets.

@TylorS
Created May 1, 2017 15:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TylorS/16548f7569c6816c50c88adce692a4de to your computer and use it in GitHub Desktop.
Save TylorS/16548f7569c6816c50c88adce692a4de to your computer and use it in GitHub Desktop.
esnextbin sketch
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>ESNextbin Sketch</title>
<!-- put additional styles and scripts here -->
</head>
<body>
<!-- put markup and other contents here -->
</body>
</html>
console.clear()
import { fromEvent, from, concat } from 'most'
import events from 'events'
const emitter = new events.EventEmitter()
const stream = fromEvent( 'event', emitter ).multicast()
const skipStream = stream.take( 1 )
const result = concat( skipStream, stream.skip( 1 ) )
result.observe(console.log)
for ( let i = 1; i <= 5; i++ )
emitter.emit( 'event', i )
{
"name": "esnextbin-sketch",
"version": "0.0.0",
"dependencies": {
"most": "1.2.2",
"undefined": "v4.5.0"
}
}
'use strict';
var _most = require('most');
var _events = require('events');
var _events2 = _interopRequireDefault(_events);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
console.clear();
var emitter = new _events2.default.EventEmitter();
var stream = (0, _most.fromEvent)('event', emitter).multicast();
var skipStream = stream.take(1);
var result = (0, _most.concat)(skipStream, stream.skip(1));
result.observe(console.log);
for (var i = 1; i <= 5; i++) {
emitter.emit('event', i);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment