Please sign in to comment.
refactor: turns out that the whole server interaction couldnt possibl…
…y work because it didnt take into account concurrent connections. so, lots of changes, good thing it was caught before release
- Loading branch information...
Showing with 396 additions and 714 deletions.
|@@ -0,0 +1,44 @@|
|_ = require 'lodash'|
|Rx = require 'rx-lite'|
|toHTML = require 'vdom-to-html'|
|z = require './z'|
|StateFactory = require './state_factory'|
|Promise = if window?|
|_promiz = 'promiz'|
|module.exports = (tree) ->|
|new Promise (resolve) ->|
|# for unbinding|
|allStates = |
|states = |
|disposables = |
|listener = ->|
|states = z._getRecordedStates()|
|allStates = allStates.concat states|
|_.map states, (state) ->|
|disposables.push state.subscribe listener|
|finish = ->|
|isDone = _.every states, (state) ->|
|result = z tree|
|_.map disposables, (disposable) -> disposable.dispose()|
|_.map allStates, (state) -> state._unbind_subscriptions()|
|resolve toHTML result|
Oops, something went wrong.