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

Side by Side Diff: appengine/config_service/ui/bower_components/shadycss/src/document-wait.js

Issue 2923973003: Added base template for config ui. (Closed)
Patch Set: Created 3 years, 6 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 @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
11 'use strict';
12
13 /** @type {Promise<void>} */
14 let readyPromise = null;
15
16 /** @type {?function(?function())} */
17 let whenReady = window['HTMLImports'] && window['HTMLImports']['whenReady'] || n ull;
18
19 /** @type {function()} */
20 let resolveFn;
21
22 /**
23 * @param {?function()} callback
24 */
25 export default function documentWait(callback) {
26 requestAnimationFrame(function() {
27 if (whenReady) {
28 whenReady(callback)
29 } else {
30 if (!readyPromise) {
31 readyPromise = new Promise((resolve) => {resolveFn = resolve});
32 if (document.readyState === 'complete') {
33 resolveFn();
34 } else {
35 document.addEventListener('readystatechange', () => {
36 if (document.readyState === 'complete') {
37 resolveFn();
38 }
39 });
40 }
41 }
42 readyPromise.then(function(){ callback && callback(); });
43 }
44 });
45 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698