yoshuawuyts / barracks

:mountain_railway: action dispatcher for unidirectional data flows

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

expose .on and .emit after initialization

yoshuawuyts opened this issue · comments

commented

not recommending to do things dynamically, but being able to pass around an instance is neat.

commented

Removes the need for a large up-front object of requirements

commented

possibly leverage the .on('foo:bar:bin:baz', () =>) shiz; or just .on('foo:bar', () =>)

commented
const barracks = require('barracks')

const d = barracks()
d.on('courses:get', () => console.log('whoop!')
d.on('courses:post', (ev, data, wait) => wait(['foobar', 'binbaz']))

d('courses:post', {my: 'data'})
commented
  • remove payload delegation (only direct passing of stuff)
  • remove dependance on this
  • next should be optional
  • waitFor === next
commented

could also turn wait into an object with yieldable values. E.g. going the co route

commented

Or just make wait return a Promise, so it can be yielded through Babel. Mwhehhhhh

commented

Should also be infinitely nestable, like with wayfarer.

commented

We should probably leverage mounting semantics as outlined in choojs/wayfarer#12, making this the data transport counterpart to wayfarer.

commented

Closed in 138aeac