| OLD | NEW |
| (Empty) |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 'use strict'; | |
| 6 | |
| 7 if (mojoBindings) { | |
| 8 throw new Error('mojoBindings has been initialized.'); | |
| 9 } | |
| 10 | |
| 11 var mojoBindings = {}; | |
| 12 mojoBindings.internal = {}; | |
| 13 mojoBindings.internal.global = this; | |
| 14 | |
| 15 (function() { | |
| 16 var internal = mojoBindings.internal; | |
| 17 | |
| 18 function exposeNamespace(namespace) { | |
| 19 var current = internal.global; | |
| 20 var parts = namespace.split('.'); | |
| 21 | |
| 22 for (var part; parts.length && (part = parts.shift());) { | |
| 23 if (!current[part]) { | |
| 24 current[part] = {}; | |
| 25 } | |
| 26 current = current[part]; | |
| 27 } | |
| 28 | |
| 29 return current; | |
| 30 } | |
| 31 | |
| 32 internal.exposeNamespace = exposeNamespace; | |
| 33 })(); | |
| OLD | NEW |