aboutsummaryrefslogtreecommitdiff
path: root/node_modules/montage/core/promise.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/montage/core/promise.js')
-rwxr-xr-xnode_modules/montage/core/promise.js36
1 files changed, 22 insertions, 14 deletions
diff --git a/node_modules/montage/core/promise.js b/node_modules/montage/core/promise.js
index df063846..eb9ccd86 100755
--- a/node_modules/montage/core/promise.js
+++ b/node_modules/montage/core/promise.js
@@ -30,7 +30,15 @@
30 30
31"use strict"; 31"use strict";
32 32
33var TIMER; 33var GET = "get",
34 PUT = "put",
35 DELETE = "delete",
36 POST = "post",
37 APPLY = "apply",
38 KEYS = "keys",
39 THEN = "then",
40 TIMER;
41
34try { 42try {
35 // bootstrapping can't handle relative identifiers 43 // bootstrapping can't handle relative identifiers
36 TIMER = require("core/next-tick"); 44 TIMER = require("core/next-tick");
@@ -76,7 +84,7 @@ var Creatable = Object.create(Object.prototype, {
76 }, 84 },
77 writable: true, 85 writable: true,
78 configurable: true 86 configurable: true
79 }, 87 }
80}); 88});
81 89
82// Common implementation details of FulfilledPromise, RejectedPromise, and 90// Common implementation details of FulfilledPromise, RejectedPromise, and
@@ -335,7 +343,7 @@ var PrimordialPromise = Creatable.create({
335 this.Promise.reject(reason, error) 343 this.Promise.reject(reason, error)
336 ); 344 );
337 } 345 }
338 }, 346 }
339 347
340 }) 348 })
341 }, 349 },
@@ -370,7 +378,7 @@ var PrimordialPromise = Creatable.create({
370 } 378 }
371 379
372 }) 380 })
373 }, 381 }
374 382
375}); 383});
376 384
@@ -433,11 +441,11 @@ var Promise = PrimordialPromise.create({}, { // Descriptor for each of the three
433 toPromise(value) 441 toPromise(value)
434 .sendPromise( 442 .sendPromise(
435 fulfill, 443 fulfill,
436 "then", 444 THEN,
437 reject 445 reject
438 ) 446 )
439 }, 447 },
440 "then", 448 THEN,
441 function (reason, error, rejection) { 449 function (reason, error, rejection) {
442 if (done) { 450 if (done) {
443 return; 451 return;
@@ -473,51 +481,51 @@ var Promise = PrimordialPromise.create({}, { // Descriptor for each of the three
473 481
474 get: { 482 get: {
475 value: function () { 483 value: function () {
476 return this.send("get", arguments); 484 return this.send(GET, arguments);
477 } 485 }
478 }, 486 },
479 487
480 put: { 488 put: {
481 value: function () { 489 value: function () {
482 return this.send("put", arguments); 490 return this.send(PUT, arguments);
483 } 491 }
484 }, 492 },
485 493
486 "delete": { 494 "delete": {
487 value: function () { 495 value: function () {
488 return this.send("delete", arguments); 496 return this.send(DELETE, arguments);
489 } 497 }
490 }, 498 },
491 499
492 post: { 500 post: {
493 value: function () { 501 value: function () {
494 return this.send("post", arguments); 502 return this.send(POST, arguments);
495 } 503 }
496 }, 504 },
497 505
498 invoke: { 506 invoke: {
499 value: function (name /*, ...args*/) { 507 value: function (name /*, ...args*/) {
500 var args = Array.prototype.slice.call(arguments, 1); 508 var args = Array.prototype.slice.call(arguments, 1);
501 return this.send("post", [name, args]); 509 return this.send(POST, [name, args]);
502 } 510 }
503 }, 511 },
504 512
505 apply: { 513 apply: {
506 value: function () { 514 value: function () {
507 return this.send("apply", arguments); 515 return this.send(APPLY, arguments);
508 } 516 }
509 }, 517 },
510 518
511 call: { 519 call: {
512 value: function (thisp /*, ...args*/) { 520 value: function (thisp /*, ...args*/) {
513 var args = Array.prototype.slice.call(arguments, 1); 521 var args = Array.prototype.slice.call(arguments, 1);
514 return this.send("apply", [thisp, args]); 522 return this.send(APPLY, [thisp, args]);
515 } 523 }
516 }, 524 },
517 525
518 keys: { 526 keys: {
519 value: function () { 527 value: function () {
520 return this.send("keys", []); 528 return this.send(KEYS, []);
521 } 529 }
522 }, 530 },
523 531