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

Unified Diff: third_party/WebKit/Source/devtools/front_end/platform/utilities.js

Issue 2611843010: DevTools: move DOMExtension.js into ui module. (Closed)
Patch Set: Introduce progress monitor Created 3 years, 11 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: third_party/WebKit/Source/devtools/front_end/platform/utilities.js
diff --git a/third_party/WebKit/Source/devtools/front_end/platform/utilities.js b/third_party/WebKit/Source/devtools/front_end/platform/utilities.js
index 1edf9b970a48ff10343a6efb4712211a02eae093..73f1da98a56343803e2963659a181f2b22732206 100644
--- a/third_party/WebKit/Source/devtools/front_end/platform/utilities.js
+++ b/third_party/WebKit/Source/devtools/front_end/platform/utilities.js
@@ -1440,3 +1440,23 @@ Map.prototype.diff = function(other, isEqual) {
}
return {added: added, removed: removed, equal: equal};
};
+
+/**
+ * TODO: move into its own module
+ * @param {function()} callback
+ * @suppressGlobalPropertiesCheck
+ */
+function runOnWindowLoad(callback) {
+ /**
+ * @suppressGlobalPropertiesCheck
+ */
+ function windowLoaded() {
+ self.removeEventListener('DOMContentLoaded', windowLoaded, false);
+ callback();
+ }
+
+ if (document.readyState === 'complete' || document.readyState === 'interactive')
+ callback();
+ else
+ self.addEventListener('DOMContentLoaded', windowLoaded, false);
+}

Powered by Google App Engine
This is Rietveld 408576698