author | Clipperz <info@clipperz.com> | 2013-01-08 15:21:04 (UTC) |
---|---|---|
committer | Clipperz <info@clipperz.com> | 2013-01-08 15:21:04 (UTC) |
commit | 816fc35420a434b1d54ae5833d617608f7456048 (patch) (unidiff) | |
tree | 95b8caf354083593d7775e4dda6f4c556b44a2d9 /frontend/gamma/js/Clipperz/Async.js | |
parent | 267603e3aa3cf0029411e67ae14018b52344c296 (diff) | |
download | clipperz-816fc35420a434b1d54ae5833d617608f7456048.zip clipperz-816fc35420a434b1d54ae5833d617608f7456048.tar.gz clipperz-816fc35420a434b1d54ae5833d617608f7456048.tar.bz2 |
Updated version of /gamma
Tons of changes, included a new draft of the mobile version (still VERY rough)
Diffstat (limited to 'frontend/gamma/js/Clipperz/Async.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/gamma/js/Clipperz/Async.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/frontend/gamma/js/Clipperz/Async.js b/frontend/gamma/js/Clipperz/Async.js index 97d8ecf..f7a9517 100644 --- a/frontend/gamma/js/Clipperz/Async.js +++ b/frontend/gamma/js/Clipperz/Async.js | |||
@@ -468,99 +468,99 @@ MochiKit.Base.update(Clipperz.Async, { | |||
468 | methods = MochiKit.Base.values(someRequests); | 468 | methods = MochiKit.Base.values(someRequests); |
469 | 469 | ||
470 | deferredResult = new Clipperz.Async.Deferred(aName, args); | 470 | deferredResult = new Clipperz.Async.Deferred(aName, args); |
471 | deferredResult.addCallback(Clipperz.Async.forkAndJoin(aName + " [inner forkAndJoin]", methods, args)); | 471 | deferredResult.addCallback(Clipperz.Async.forkAndJoin(aName + " [inner forkAndJoin]", methods, args)); |
472 | deferredResult.addBoth(function(someResults) { | 472 | deferredResult.addBoth(function(someResults) { |
473 | var returnFunction; | 473 | var returnFunction; |
474 | var results; | 474 | var results; |
475 | var i,c; | 475 | var i,c; |
476 | var result; | 476 | var result; |
477 | 477 | ||
478 | if (someResults instanceof MochiKit.Async.CancelledError) { | 478 | if (someResults instanceof MochiKit.Async.CancelledError) { |
479 | returnFunction = MochiKit.Async.fail; | 479 | returnFunction = MochiKit.Async.fail; |
480 | result = someResults; | 480 | result = someResults; |
481 | } else { | 481 | } else { |
482 | if (someResults instanceof Error) { | 482 | if (someResults instanceof Error) { |
483 | returnFunction = MochiKit.Async.fail; | 483 | returnFunction = MochiKit.Async.fail; |
484 | results = someResults['message']; | 484 | results = someResults['message']; |
485 | } else { | 485 | } else { |
486 | returnFunction = MochiKit.Async.succeed; | 486 | returnFunction = MochiKit.Async.succeed; |
487 | results = someResults; | 487 | results = someResults; |
488 | } | 488 | } |
489 | 489 | ||
490 | result = {}; | 490 | result = {}; |
491 | 491 | ||
492 | c = requestKeys.length; | 492 | c = requestKeys.length; |
493 | for (i=0; i<c; i++) { | 493 | for (i=0; i<c; i++) { |
494 | result[requestKeys[i]] = results[i]; | 494 | result[requestKeys[i]] = results[i]; |
495 | } | 495 | } |
496 | } | 496 | } |
497 | 497 | ||
498 | return returnFunction.call(null, result); | 498 | return returnFunction.call(null, result); |
499 | }); | 499 | }); |
500 | deferredResult.callback(aValue); | 500 | deferredResult.callback(aValue); |
501 | 501 | ||
502 | return deferredResult; | 502 | return deferredResult; |
503 | }, aName, someRequests, args); | 503 | }, aName, someRequests, args); |
504 | }, | 504 | }, |
505 | 505 | ||
506 | //------------------------------------------------------------------------- | 506 | //------------------------------------------------------------------------- |
507 | 507 | ||
508 | 'collectAll': function (someDeferredObjects) { | 508 | 'collectAll': function (someDeferredObjects) { |
509 | var deferredResult; | 509 | var deferredResult; |
510 | 510 | ||
511 | deferredResult = new MochiKit.Async.DeferredList(someDeferredObjects, false, false, false); | 511 | deferredResult = new MochiKit.Async.DeferredList(someDeferredObjects, false, false, false); |
512 | deferredResult.addCallback(function (aResultList) { | 512 | deferredResult.addCallback(function (aResultList) { |
513 | return MochiKit.Base.map(function (aResult) { | 513 | return MochiKit.Base.map(function (aResult) { |
514 | if (aResult[0]) { | 514 | if (aResult[0]) { |
515 | return aResult[1]; | 515 | return aResult[1]; |
516 | } else { | 516 | } else { |
517 | throw aResult[1]; | 517 | throw aResult[1]; |
518 | } | 518 | } |
519 | }, aResultList); | 519 | }, aResultList); |
520 | }); | 520 | }); |
521 | 521 | ||
522 | return deferredResult; | 522 | return deferredResult; |
523 | }, | 523 | }, |
524 | 524 | ||
525 | //------------------------------------------------------------------------- | 525 | //------------------------------------------------------------------------- |
526 | 526 | ||
527 | 'setItem': function (anObject, aKey, aValue) { | 527 | 'setItem': function (anObject, aKey, aValue) { |
528 | anObject[aKey] = aValue; | 528 | anObject[aKey] = aValue; |
529 | 529 | ||
530 | return anObject; | 530 | return anObject; |
531 | }, | 531 | }, |
532 | 532 | ||
533 | 'setItemOnObject': function (aKey, aValue, anObject) { | 533 | 'setItemOnObject': function (aKey, aValue, anObject) { |
534 | anObject[aKey] = aValue; | 534 | anObject[aKey] = aValue; |
535 | 535 | ||
536 | return anObject; | 536 | return anObject; |
537 | }, | 537 | }, |
538 | 538 | ||
539 | 'setDeferredItemOnObject': function (aKey, aDeferredFunction, anObject) { | 539 | 'setDeferredItemOnObject': function (aKey, aDeferredFunction, anObject) { |
540 | return Clipperz.Async.callbacks("Clipperz.Async.setDeferredItemOnObject", [ | 540 | return Clipperz.Async.callbacks("Clipperz.Async.setDeferredItemOnObject", [ |
541 | aDeferredFunction, | 541 | aDeferredFunction, |
542 | MochiKit.Base.partial(Clipperz.Async.setItem, anObject, aKey) | 542 | MochiKit.Base.partial(Clipperz.Async.setItem, anObject, aKey) |
543 | ], {trace:false}, anObject); | 543 | ], {trace:false}, anObject); |
544 | }, | 544 | }, |
545 | 545 | ||
546 | //------------------------------------------------------------------------- | 546 | //------------------------------------------------------------------------- |
547 | 547 | ||
548 | 'deferredIf': function (aName, aThenBlock, anElseBlock) { | 548 | 'deferredIf': function (aName, aThenBlock, anElseBlock) { |
549 | return function (aValue) { | 549 | return function (aValue) { |
550 | var deferredResult; | 550 | var deferredResult; |
551 | 551 | ||
552 | if (!MochiKit.Base.isUndefinedOrNull(aValue) && aValue) { | 552 | if (!MochiKit.Base.isUndefinedOrNull(aValue) && aValue) { |
553 | deferredResult = Clipperz.Async.callbacks(aName + " <then>", aThenBlock, null, aValue); | 553 | deferredResult = Clipperz.Async.callbacks(aName + " <then>", aThenBlock, null, aValue); |
554 | } else { | 554 | } else { |
555 | deferredResult = Clipperz.Async.callbacks(aName + " <else>", anElseBlock, null, aValue); | 555 | deferredResult = Clipperz.Async.callbacks(aName + " <else>", anElseBlock, null, aValue); |
556 | } | 556 | } |
557 | 557 | ||
558 | return deferredResult; | 558 | return deferredResult; |
559 | } | 559 | } |
560 | }, | 560 | }, |
561 | 561 | ||
562 | //------------------------------------------------------------------------- | 562 | //------------------------------------------------------------------------- |
563 | 563 | ||
564 | 'log': function(aMessage, aResult) { | 564 | 'log': function(aMessage, aResult) { |
565 | if (CLIPPERZ_DEFERRED_LOGGING_ENABLED) { | 565 | if (CLIPPERZ_DEFERRED_LOGGING_ENABLED) { |
566 | Clipperz.log(aMessage + " ", aResult); | 566 | Clipperz.log(aMessage + " ", aResult); |