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

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

Issue 710033003: [DevTools] Extract part of DevTools into inspector app. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 1 month 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: Source/devtools/front_end/platform/utilities.js
diff --git a/Source/devtools/front_end/platform/utilities.js b/Source/devtools/front_end/platform/utilities.js
index 7c9301cf5abe8388163e879d5cef35f521994f35..45305c8b5905dcb8c15b43343a13b002a068d3ae 100644
--- a/Source/devtools/front_end/platform/utilities.js
+++ b/Source/devtools/front_end/platform/utilities.js
@@ -1435,3 +1435,24 @@ self.setImmediate = function(callback)
Promise.resolve().then(callback).done();
return 0;
}
+
+/**
+ * @param {!function()} callback
+ * @suppressGlobalPropertiesCheck
+ */
+function runOnWindowLoad(callback)
+{
+ /**
+ * @suppressGlobalPropertiesCheck
+ */
+ function windowLoaded()
+ {
+ window.removeEventListener("DOMContentLoaded", windowLoaded, false);
+ callback();
+ }
+
+ if (document.readyState === "complete")
+ callback();
+ else
+ window.addEventListener("DOMContentLoaded", windowLoaded, false);
+}

Powered by Google App Engine
This is Rietveld 408576698