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

Unified Diff: ui/webui/resources/cr_elements/cr_lazy_render/cr_lazy_render.js

Issue 2341923005: MD WebUI: Make cr-lazy-render get() synchronous (Closed)
Patch Set: Rebase Created 4 years, 3 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 | « chrome/test/data/webui/md_history/history_overflow_menu_test.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/webui/resources/cr_elements/cr_lazy_render/cr_lazy_render.js
diff --git a/ui/webui/resources/cr_elements/cr_lazy_render/cr_lazy_render.js b/ui/webui/resources/cr_elements/cr_lazy_render/cr_lazy_render.js
index b7c58f7d4980de51c97eb028e3be72dd36ff784a..627505a4364e888cc6ab730152247caeed1afb36 100644
--- a/ui/webui/resources/cr_elements/cr_lazy_render/cr_lazy_render.js
+++ b/ui/webui/resources/cr_elements/cr_lazy_render/cr_lazy_render.js
@@ -11,9 +11,7 @@
* <heavy-menu></heavy-menu>
* </template>
*
- * this.$.menu.get().then(function(menu) {
- * menu.show();
- * });
+ * this.$.menu.get().show();
*/
Polymer({
@@ -24,28 +22,17 @@ Polymer({
Polymer.Templatizer
],
- /** @private {Promise<Element>} */
- renderPromise_: null,
-
/** @private {TemplatizerNode} */
child_: null,
/**
- * Stamp the template into the DOM tree asynchronously
- * @return {Promise<Element>} Promise which resolves when the template has
- * been stamped.
+ * Stamp the template into the DOM tree synchronously
+ * @return {Element} Child element which has been stamped into the DOM tree.
*/
get: function() {
- if (!this.renderPromise_) {
- this.renderPromise_ = new Promise(function(resolve) {
- this._debounceTemplate(function() {
- this.render_();
- this.renderPromise_ = null;
- resolve(this.getIfExists());
- }.bind(this));
- }.bind(this));
- }
- return this.renderPromise_;
+ if (!this.child_)
+ this.render_();
+ return this.child_;
},
/**
« no previous file with comments | « chrome/test/data/webui/md_history/history_overflow_menu_test.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698