Add ViewRegistry.prototype.getNextUpdatePromise

Signed-off-by: Max Brunsfeld <maxbrunsfeld@github.com>
This commit is contained in:
Nathan Sobo
2015-10-23 18:13:30 -06:00
parent cdaac9dfcc
commit 1aefb22789
2 changed files with 25 additions and 0 deletions

View File

@@ -195,6 +195,10 @@ class ViewRegistry
pollAfterNextUpdate: ->
@performDocumentPollAfterUpdate = true
getNextUpdatePromise: ->
@nextUpdatePromise ?= new Promise (resolve) =>
@resolveNextUpdatePromise = resolve
clearDocumentRequests: ->
@documentReaders = []
@documentWriters = []
@@ -220,6 +224,9 @@ class ViewRegistry
# process updates requested as a result of reads
writer() while writer = @documentWriters.shift()
@nextUpdatePromise = null
@resolveNextUpdatePromise?()
startPollingDocument: ->
window.addEventListener('resize', @requestDocumentPoll)
@observer.observe(document, {subtree: true, childList: true, attributes: true})