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

Unified Diff: packages/template_binding/lib/js/flush.js

Issue 2989763002: Update charted to 0.4.8 and roll (Closed)
Patch Set: Removed Cutch from list of reviewers Created 3 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « packages/template_binding/codereview.settings ('k') | packages/template_binding/lib/js/microtask.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: packages/template_binding/lib/js/flush.js
diff --git a/packages/template_binding/lib/js/flush.js b/packages/template_binding/lib/js/flush.js
deleted file mode 100644
index 61da3a8fb23a3e562a281b9817b7b5394aca1898..0000000000000000000000000000000000000000
--- a/packages/template_binding/lib/js/flush.js
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * 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) {
-
-/**
- * @class Polymer
- */
-
-// imports
-var endOfMicrotask = scope.endOfMicrotask;
-
-// logging
-var log = window.WebComponents ? WebComponents.flags.log : {};
-
-// 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);
-
-
-/**
- * Force any pending data changes to be observed before
- * the next task. Data changes are processed asynchronously but are guaranteed
- * to be processed, for example, before paintin. This method should rarely be
- * needed. It does nothing when Object.observe is available;
- * when Object.observe is not available, Polymer automatically flushes data
- * changes approximately every 1/10 second.
- * Therefore, `flush` should only be used when a data mutation should be
- * observed sooner than this.
- *
- * @method flush
- */
-// flush (with logging)
-var flushing;
-function flush() {
- if (!flushing) {
- flushing = true;
- endOfMicrotask(function() {
- flushing = false;
- log.data && console.group('flush');
- Platform.performMicrotaskCheckpoint();
- log.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();
- // watch document visiblity to toggle dirty-checking
- var visibilityHandler = function() {
- // only flush if the page is visibile
- if (document.visibilityState === 'hidden') {
- if (scope.flushPoll) {
- clearInterval(scope.flushPoll);
- }
- } else {
- scope.flushPoll = setInterval(flush, FLUSH_POLL_INTERVAL);
- }
- };
- if (typeof document.visibilityState === 'string') {
- document.addEventListener('visibilitychange', visibilityHandler);
- }
- visibilityHandler();
- });
-} 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;
-// bc
-Platform.flush = flush;
-
-})(window.Polymer);
-
« no previous file with comments | « packages/template_binding/codereview.settings ('k') | packages/template_binding/lib/js/microtask.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698