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

Unified Diff: chrome/browser/resources/settings/controls/settings_idle_render.js

Issue 2754563002: MD Settings: Lazy load the contents of the "advanced" settings. (Closed)
Patch Set: Address comments. Created 3 years, 9 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
Index: chrome/browser/resources/settings/controls/settings_idle_render.js
diff --git a/chrome/browser/resources/settings/controls/settings_idle_render.js b/chrome/browser/resources/settings/controls/settings_idle_render.js
deleted file mode 100644
index 8e224c9e5414b54437e08f556a7411fdbb2a9868..0000000000000000000000000000000000000000
--- a/chrome/browser/resources/settings/controls/settings_idle_render.js
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-/**
- * @fileoverview
- * settings-idle-render is a simple variant of dom-if designed for lazy
- * rendering of elements that are accessed imperatively.
- * If a use for idle time expansion is found outside of settings, this code
- * should be replaced by cr-lazy-render after that feature is merged into
- * ui/webui/resources/cr_elements/cr_lazy_render/cr_lazy_render.js
- */
-
-Polymer({
- is: 'settings-idle-render',
- extends: 'template',
-
- behaviors: [Polymer.Templatizer],
-
- /** @private {TemplatizerNode} */
- child_: null,
-
- /** @private {number} */
- idleCallback_: 0,
-
- /** @override */
- attached: function() {
- this.idleCallback_ = requestIdleCallback(this.render_.bind(this));
- },
-
- /** @override */
- detached: function() {
- // No-op if callback already fired.
- cancelIdleCallback(this.idleCallback_);
- },
-
- /**
- * Stamp the template into the DOM tree synchronously
- * @return {Element} Child element which has been stamped into the DOM tree.
- */
- get: function() {
- if (!this.child_)
- this.render_();
- return this.child_;
- },
-
- /** @private */
- render_: function() {
- if (!this.ctor)
- this.templatize(this);
- var parentNode = this.parentNode;
- if (parentNode && !this.child_) {
- var instance = this.stamp({});
- this.child_ = instance.root.firstElementChild;
- parentNode.insertBefore(instance.root, this);
- }
- },
-
- /**
- * @param {string} prop
- * @param {Object} value
- */
- _forwardParentProp: function(prop, value) {
- if (this.child_)
- this.child_._templateInstance[prop] = value;
- },
-
- /**
- * @param {string} path
- * @param {Object} value
- */
- _forwardParentPath: function(path, value) {
- if (this.child_)
- this.child_._templateInstance.notifyPath(path, value, true);
- }
-});
« no previous file with comments | « chrome/browser/resources/settings/controls/settings_idle_render.html ('k') | chrome/browser/resources/settings/route.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698