| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 (function() { | |
| 6 "use strict"; | |
| 7 | |
| 8 var RESOURCES_TO_LOAD = [ | |
| 9 'chrome://resources/polymer/v1_0/iron-icons/iron-icons.html', | |
| 10 'chrome://resources/polymer/v1_0/paper-button/paper-button.html' | |
| 11 ]; | |
| 12 /* const */ var IDLE_TIMEOUT_MS = 200; | |
| 13 | |
| 14 window.addEventListener('load', function() { | |
| 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 (var resourceUrl of RESOURCES_TO_LOAD) { | |
| 21 var link = document.createElement('link'); | |
| 22 link.rel = 'import'; | |
| 23 link.href = resourceUrl; | |
| 24 document.head.appendChild(link); | |
| 25 } | |
| 26 }, { timeout: IDLE_TIMEOUT_MS }); | |
| 27 }); | |
| 28 })(); | |
| OLD | NEW |