Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(111)

Side by Side Diff: packages/template_binding/lib/js/microtask.js

Issue 2989763002: Update charted to 0.4.8 and roll (Closed)
Patch Set: Removed Cutch from list of reviewers Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
3 * This code may only be used under the BSD style license found at http://polyme r.github.io/LICENSE.txt
4 * The complete set of authors may be found at http://polymer.github.io/AUTHORS. txt
5 * The complete set of contributors may be found at http://polymer.github.io/CON TRIBUTORS.txt
6 * Code distributed by Google as part of the polymer project is also
7 * subject to an additional IP rights grant found at http://polymer.github.io/PA TENTS.txt
8 */
9
10 (function(scope) {
11
12 var iterations = 0;
13 var callbacks = [];
14 var twiddle = document.createTextNode('');
15
16 function endOfMicrotask(callback) {
17 twiddle.textContent = iterations++;
18 callbacks.push(callback);
19 }
20
21 function atEndOfMicrotask() {
22 while (callbacks.length) {
23 callbacks.shift()();
24 }
25 }
26
27 new (window.MutationObserver || JsMutationObserver)(atEndOfMicrotask)
28 .observe(twiddle, {characterData: true})
29 ;
30
31 // exports
32 scope.endOfMicrotask = endOfMicrotask;
33 // bc
34 Platform.endOfMicrotask = endOfMicrotask;
35
36 })(Polymer);
37
OLDNEW
« no previous file with comments | « packages/template_binding/lib/js/flush.js ('k') | packages/template_binding/lib/js/node_bind.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698