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

Unified Diff: ui/webui/resources/js/util.js

Issue 2470063003: Move importModules function to util.js (Closed)
Patch Set: Add suppress Created 4 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
« no previous file with comments | « chrome/test/data/webui/plugins_browsertest.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/js/util.js
diff --git a/ui/webui/resources/js/util.js b/ui/webui/resources/js/util.js
index d33663fce350ae2e39295def3210a2775973a611..9f299674db0458edbfca59071dfc61aa917ea53a 100644
--- a/ui/webui/resources/js/util.js
+++ b/ui/webui/resources/js/util.js
@@ -486,3 +486,17 @@ if (!('key' in KeyboardEvent.prototype)) {
window.console.log("KeyboardEvent.Key polyfill not required");
}
// </if> /* is_ios */
+
+/**
+ * Helper to convert callback-based define() API to a promise-based API.
+ * @suppress {undefinedVars}
+ * @param {!Array<string>} moduleNames
+ * @return {!Promise}
+ */
+function importModules(moduleNames) {
+ return new Promise(function(resolve) {
+ define(moduleNames, function() {
+ resolve(Array.from(arguments));
+ });
+ });
+}
« no previous file with comments | « chrome/test/data/webui/plugins_browsertest.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698