OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project 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 "use strict"; | 5 "use strict"; |
6 | 6 |
7 // This file relies on the fact that the following declaration has been made | 7 // This file relies on the fact that the following declaration has been made |
8 // in runtime.js: | 8 // in runtime.js: |
9 // var $Object = global.Object | 9 // var $Object = global.Object |
10 // var $WeakMap = global.WeakMap | 10 // var $WeakMap = global.WeakMap |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 } catch (e) { | 318 } catch (e) { |
319 deferred.reject(e) | 319 deferred.reject(e) |
320 } | 320 } |
321 return deferred.promise; | 321 return deferred.promise; |
322 } | 322 } |
323 | 323 |
324 // ------------------------------------------------------------------- | 324 // ------------------------------------------------------------------- |
325 // Install exported functions. | 325 // Install exported functions. |
326 | 326 |
327 %CheckIsBootstrapping(); | 327 %CheckIsBootstrapping(); |
328 %AddProperty(global, 'Promise', $Promise, DONT_ENUM); | 328 %AddNamedProperty(global, 'Promise', $Promise, DONT_ENUM); |
329 InstallFunctions($Promise, DONT_ENUM, [ | 329 InstallFunctions($Promise, DONT_ENUM, [ |
330 "defer", PromiseDeferred, | 330 "defer", PromiseDeferred, |
331 "accept", PromiseResolved, | 331 "accept", PromiseResolved, |
332 "reject", PromiseRejected, | 332 "reject", PromiseRejected, |
333 "all", PromiseAll, | 333 "all", PromiseAll, |
334 "race", PromiseOne, | 334 "race", PromiseOne, |
335 "resolve", PromiseCast | 335 "resolve", PromiseCast |
336 ]); | 336 ]); |
337 InstallFunctions($Promise.prototype, DONT_ENUM, [ | 337 InstallFunctions($Promise.prototype, DONT_ENUM, [ |
338 "chain", PromiseChain, | 338 "chain", PromiseChain, |
339 "then", PromiseThen, | 339 "then", PromiseThen, |
340 "catch", PromiseCatch | 340 "catch", PromiseCatch |
341 ]); | 341 ]); |
342 | 342 |
343 })(); | 343 })(); |
OLD | NEW |