vigour-io / brisky-struct

An observable data structure
5 stars 1 forks source link

Other emitters then data for once #152

Open jimdebeer opened 7 years ago

jimdebeer commented 7 years ago

do we need this? and what kind of syntax?

once is now

.once('condition', cb

can do 2 things cb as a string means emitter

object as condition (options)

mstdokumaci commented 7 years ago

is this also a replacement of old is, i remember that it accepted a function to test if it's time to go.

jimdebeer commented 7 years ago

condition can be a function as well indeed

youzi commented 7 years ago

Scribbles: Chain it foo.on('data').once(true, () => {}) foo.on('click').once(() => {}) Arg it foo.once('data', true, () => {}) foo.once('click', () => {}) Arg it 2 foo.once(true, () => {}, 'data') foo.once(() => {}, 'click')

jimdebeer commented 7 years ago

chain is totally doable going to that arg 2 is callbac

jimdebeer commented 7 years ago

chain is a bit heavier though else it will become arg 2

jimdebeer commented 7 years ago

if second is string like that as well