Eventing System

Pipe and subscribe were likely based on node.js streams, which in themselves
are specialized eventEmitters.

There’s some pretty decent libraries around this stuff, like event-stream and perhaps especially relevant dom delegation stream

Pipe was pretty similar to what node did, but subscribe was a bit of sugar around that basic functionality.
It essentially kept a reference to the upstream event emitter, so that you could do an unpipe on the child,
and not the parent.

Streams are pretty much my favorite abstraction when it comes to the idea of decoupling the calculation of things from the rendering, and it’s also something that I’m happy that david’s Samsara library is working towards.

For instance, once you have a working stream implementation, you can use things like workerstream to ship off calculations, using :


inputStream // take the input ,
    .pipe(workerStream) //  send it to a web worker
    .pipe(renderStream); //  and render those

That’s pretty much what I was doing with famous 0.3 with the whiteboard app I started building.

1 Like