This repository has been archived by the owner on Mar 13, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
71 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved. | ||
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt | ||
* The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt | ||
* The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt | ||
* Code distributed by Google as part of the polymer project is also | ||
* subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt | ||
*/ | ||
|
||
(function(scope) { | ||
|
||
// inject style sheet | ||
var style = document.createElement('style'); | ||
style.textContent = 'template {display: none !important;} /* injected by platform.js */'; | ||
var head = document.querySelector('head'); | ||
head.insertBefore(style, head.firstChild); | ||
|
||
// flush (with logging) | ||
var flushing; | ||
function flush() { | ||
if (!flushing) { | ||
flushing = true; | ||
scope.endOfMicrotask(function() { | ||
flushing = false; | ||
logFlags.data && console.group('Platform.flush()'); | ||
scope.performMicrotaskCheckpoint(); | ||
logFlags.data && console.groupEnd(); | ||
}); | ||
} | ||
}; | ||
|
||
// polling dirty checker | ||
// flush periodically if platform does not have object observe. | ||
if (!Observer.hasObjectObserve) { | ||
var FLUSH_POLL_INTERVAL = 125; | ||
window.addEventListener('WebComponentsReady', function() { | ||
flush(); | ||
scope.flushPoll = setInterval(flush, FLUSH_POLL_INTERVAL); | ||
}); | ||
} else { | ||
// make flush a no-op when we have Object.observe | ||
flush = function() {}; | ||
} | ||
|
||
if (window.CustomElements && !CustomElements.useNative) { | ||
var originalImportNode = Document.prototype.importNode; | ||
Document.prototype.importNode = function(node, deep) { | ||
var imported = originalImportNode.call(this, node, deep); | ||
CustomElements.upgradeAll(imported); | ||
return imported; | ||
} | ||
} | ||
|
||
// exports | ||
scope.flush = flush; | ||
|
||
})(window.Platform); | ||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.