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

Side by Side Diff: ui/login/account_picker/user_pod_template.js

Issue 1925453005: Remove most of the loading delay for warning icon. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Fix tests Created 4 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 (function() { 5 (function() {
6 "use strict"; 6 "use strict";
7 7
8 var START_LOADING_DELAY = 1000; 8 var RESOURCES_TO_LOAD = [
9 9 'chrome://resources/polymer/v1_0/iron-icons/iron-icons.html',
10 function doLazyLoad() { 10 'chrome://resources/polymer/v1_0/paper-button/paper-button.html'
11 function lazyLoadUrl(url) { 11 ];
12 var link = document.createElement('link'); 12 /* const */ var IDLE_TIMEOUT_MS = 200;
13 link.rel = 'import';
14 link.href = url;
15 document.body.appendChild(link);
16 }
17
18 lazyLoadUrl('chrome://resources/polymer/v1_0/iron-icons/iron-icons.html');
19 lazyLoadUrl(
20 'chrome://resources/polymer/v1_0/paper-button/paper-button.html');
21 }
22 13
23 window.addEventListener('load', function() { 14 window.addEventListener('load', function() {
24 setTimeout(doLazyLoad, START_LOADING_DELAY); 15 // The user pod template gets cloned shortly after the load event to make
16 // the actual user pods. It then takes a few update cycles to style these
17 // elements. Loading polymer will block the DOM, so we try to load polymer
18 // after the user pods have been cloned and styled.
19 requestIdleCallback(function() {
20 for (let resourceUrl of RESOURCES_TO_LOAD) {
21 let link = document.createElement('link');
achuithb 2016/05/05 20:18:31 we don't seem to use let in chromium. I'm wonderin
22 link.rel = 'import';
23 link.href = resourceUrl;
24 document.head.appendChild(link);
25 }
26 }, { timeout: IDLE_TIMEOUT_MS });
25 }); 27 });
26 })(); 28 })();
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698