nl_tokens: Triggers a flush of any pending events observations etc and calls you back after they have been processed .
pl_tokens: function flush ( callback ) { // Ideally, this function would be a call to Polymer.dom.flush, but that // doesn't support a callback yet // (https://github.com/Polymer/polymer-dev/issues/851), // ...and there's cross-browser flakiness to deal with. // Make sure that we're invoking the callback with no arguments so that the // caller can pass Mocha callbacks, etc. var done = function done ( ) { callback ( ) ; } ; // Because endOfMicrotask is flaky for IE, we perform microtask checkpoints // ourselves (https://github.com/Polymer/polymer-dev/issues/114): var isIE = navigator . appName === 'Microsoft Internet Explorer' ; if ( isIE && window . <mask> && window . Platform . performMicrotaskCheckpoint ) { var reallyDone_1 = done ; done = function doneIE ( ) { Platform . performMicrotaskCheckpoint ( ) ; nativeSetTimeout ( reallyDone_1 , 0 ) ; } ; } // Everyone else gets a regular flush. var scope ; if ( window . Polymer && window . Polymer . dom && window . Polymer . dom . flush ) { scope = window . Polymer . dom ; } else if ( window . Polymer && window . Polymer . flush ) { scope = window . Polymer ; } else if ( window . WebComponents && window . WebComponents . flush ) { scope = window . WebComponents ; } if ( scope ) { scope . flush ( ) ; } // Ensure that we are creating a new _task_ to allow all active microtasks to // finish (the code you're testing may be using endOfMicrotask, too). nativeSetTimeout ( done , 0 ) ; }