Skip to content

Commit

Permalink
Th͏e Da҉rk Pońy Lo͘r͠d HE ́C͡OM̴E̸S
Browse files Browse the repository at this point in the history
delay actions until next tick to keep Zalgo away

- #19 (comment)
- gcanti/tom@a0245f7#commitcomment-17479754
  • Loading branch information
ahdinosaur committed Jul 21, 2016
1 parent e9552f2 commit a32a06a
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions start.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,19 @@ function start (app) {
var run = defined(app.run, defaults.run)

var actions = notify()
var nextActions = notify()

pull(
nextActions.listen(),
drain(function (value) {
process.nextTick(function () {
actions(value)
})
})
)

function dispatch (nextAction) {
actions(nextAction)
nextActions(nextAction)
}

var initialState = init.call(app)
Expand Down Expand Up @@ -83,7 +93,8 @@ function start (app) {
models: models,
views: views,
effects: effects,
effectActionsSources: effectActionsSources
effectActionsSources: effectActionsSources,
nextActions: nextActions
}

var sources = {}
Expand All @@ -105,7 +116,7 @@ function start (app) {

pull(
effectActionsSources.listen(),
drainMany(actions)
drainMany(nextActions)
)

process.nextTick(function () {
Expand Down

0 comments on commit a32a06a

Please sign in to comment.