| OLD | NEW |
| (Empty) | |
| 1 <!-- |
| 2 @license |
| 3 Copyright (c) 2017 The Polymer Project Authors. All rights reserved. |
| 4 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt |
| 5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt |
| 6 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt |
| 7 Code distributed by Google as part of the polymer project is also |
| 8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt |
| 9 --> |
| 10 <link rel="import" href="boot.html"> |
| 11 <script> |
| 12 (function() { |
| 13 'use strict'; |
| 14 |
| 15 let debouncerQueue = []; |
| 16 |
| 17 /** |
| 18 * Adds a `Polymer.Debouncer` to a list of globally flushable tasks. |
| 19 * |
| 20 * @memberof Polymer |
| 21 * @param {Polymer.Debouncer} debouncer Debouncer to enqueue |
| 22 */ |
| 23 Polymer.enqueueDebouncer = function(debouncer) { |
| 24 debouncerQueue.push(debouncer); |
| 25 } |
| 26 |
| 27 function flushDebouncers() { |
| 28 const didFlush = Boolean(debouncerQueue.length); |
| 29 while (debouncerQueue.length) { |
| 30 try { |
| 31 debouncerQueue.shift().flush(); |
| 32 } catch(e) { |
| 33 setTimeout(() => { |
| 34 throw e; |
| 35 }); |
| 36 } |
| 37 } |
| 38 return didFlush; |
| 39 } |
| 40 |
| 41 /** |
| 42 * Forces several classes of asynchronously queued tasks to flush: |
| 43 * - Debouncers added via `enqueueDebouncer` |
| 44 * - ShadyDOM distribution |
| 45 * |
| 46 * @memberof Polymer |
| 47 */ |
| 48 Polymer.flush = function() { |
| 49 let shadyDOM, debouncers; |
| 50 do { |
| 51 shadyDOM = window.ShadyDOM && ShadyDOM.flush(); |
| 52 if (window.ShadyCSS && window.ShadyCSS.ScopingShim) { |
| 53 window.ShadyCSS.ScopingShim.flush(); |
| 54 } |
| 55 debouncers = flushDebouncers(); |
| 56 } while (shadyDOM || debouncers); |
| 57 } |
| 58 |
| 59 })(); |
| 60 </script> |
| OLD | NEW |