OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * Javascript for Mojo interface helpers, served from | 6 * Javascript for Mojo interface helpers and global variables, served from |
7 * chrome://bluetooth-internals/. | 7 * chrome://bluetooth-internals/. |
8 */ | 8 */ |
9 | 9 |
10 cr.define('interfaces', function() { | 10 cr.define('interfaces', function() { |
11 | 11 |
12 | 12 |
13 /** | 13 /** |
14 * TODO(crbug.com/652361): Move to shared location. | 14 * TODO(crbug.com/652361): Move to shared location. |
15 * Helper to convert callback-based define() API to a promise-based API. | 15 * Helper to convert callback-based define() API to a promise-based API. |
16 * @param {!Array<string>} moduleNames | 16 * @param {!Array<string>} moduleNames |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 | 69 |
70 function initialize() { | 70 function initialize() { |
71 if (initialized) { | 71 if (initialized) { |
72 return Promise.resolve(); | 72 return Promise.resolve(); |
73 } | 73 } |
74 | 74 |
75 if (initializePromise) { | 75 if (initializePromise) { |
76 return initializePromise; | 76 return initializePromise; |
77 } | 77 } |
78 | 78 |
79 initializePromise = initializeProxies().then(function () { | 79 initializePromise = initializeProxies().then(function() { |
80 initialized = true; | 80 initialized = true; |
81 }); | 81 }); |
82 | 82 |
83 return initializePromise; | 83 return initializePromise; |
84 } | 84 } |
85 | 85 |
86 return { | 86 return { |
87 initialize: initialize, | 87 initialize: initialize, |
88 }; | 88 }; |
89 }); | 89 }); |
OLD | NEW |