yoshuawuyts / barracks

:mountain_railway: action dispatcher for unidirectional data flows
MIT License
177 stars 22 forks source link

add store.use() method #58

Closed yoshuawuyts closed 8 years ago

yoshuawuyts commented 8 years ago

Allows declaring multiple hooks through store.use(hooks). All hooks will now be executed on every call. Useful to register multiple handlers and stuff ✌️

const barracks = require('barracks')
const log = require('choo-log')

const store = barracks()
store.use(log())

const createSend = store.start()
yoshuawuyts commented 8 years ago

Oh, to clarify: no breaking changes. Minor version

coveralls commented 8 years ago

Coverage Status

Coverage increased (+0.5%) to 95.172% when pulling 6bc9b11c893c5f5f247bc1a708ab784a7e872bc1 on use into b381a971ec72102caf6570756bb3d63a8e6f885e on master.

toddself commented 8 years ago

This is cool with me if we don't mind the arrays part? (We could always Array.isArray is if we really wanted to prevent it)

yoshuawuyts commented 8 years ago

@toddself yeah, I'm not too fussed about it - feel like the assert() calls we got is to prevent people from making lil accidental mistakes - nothing too strict - most common use case I can imagine that would occur is that they'd forget to initialize a function, so it doesn't return an object and we'd catch that and warn :sparkles:

coveralls commented 8 years ago

Coverage Status

Coverage increased (+0.5%) to 95.238% when pulling e20ff726c8dbd17c61348977a8f263163b779f4d on use into b381a971ec72102caf6570756bb3d63a8e6f885e on master.

yoshuawuyts commented 8 years ago

Welp, think this is good to merge then :sparkles:

yoshuawuyts commented 8 years ago

released as v8.1.0 :grin: