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

Unified Diff: mojo/public/js/new_bindings/base.js

Issue 2759563004: Mojo JS bindings: change module loading solution. (Closed)
Patch Set: Make sure mojo_bindings.js is packaged in build result for running layout tests. 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
« no previous file with comments | « mojo/public/js/BUILD.gn ('k') | mojo/public/js/new_bindings/bindings.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/js/new_bindings/base.js
diff --git a/mojo/public/js/new_bindings/base.js b/mojo/public/js/new_bindings/base.js
new file mode 100644
index 0000000000000000000000000000000000000000..ef7aa32f73646c47bec8b51694b458ad50d929a7
--- /dev/null
+++ b/mojo/public/js/new_bindings/base.js
@@ -0,0 +1,33 @@
+// 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.
+
+'use strict';
+
+if (mojo && mojo.internal) {
+ throw new Error('The Mojo bindings library has been initialized.');
+}
+
+var mojo = mojo || {};
+mojo.internal = {};
+mojo.internal.global = this;
+
+(function() {
+ var internal = mojo.internal;
+
+ function exposeNamespace(namespace) {
+ var current = internal.global;
+ var parts = namespace.split('.');
+
+ for (var part; parts.length && (part = parts.shift());) {
+ if (!current[part]) {
+ current[part] = {};
+ }
+ current = current[part];
+ }
+
+ return current;
+ }
+
+ internal.exposeNamespace = exposeNamespace;
+})();
« no previous file with comments | « mojo/public/js/BUILD.gn ('k') | mojo/public/js/new_bindings/bindings.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698