After having a deeper look at as3commons-async I think it is pretty unmature, however: I actually quite like the new threading API that uses promises.

Imagine:

  var serial: Async = new Async();
  serial.
.next( thread.doSomething() ) // passes the Promise from "thread.doSomething" to the chain and waits for the execution .error( handleErrorOfTheThread ) // handles a error message from the former thread result .next( loadFile("myAwesomeFile") ) // instantiates a url loading process and creates a Promise that it will return the File... .error( Async.INTERRUPT ) // Any error that happens here causes to interrupt the staple execution .handle( createGUI ) // gets the File passed on success and instantiates a class .next( animate( gui, {x: 200} ); // lets the gui slide in (also creates the promise that its there .revert( animate( gui, {x: -100} ); // to be called if the "Async" task was canceled for some reason
            .next( guiDone );

If all those methods would return "Promises" (Yeah, I will pass that file some day) then Threads could be easily integrated with other async calls.

wouldn't that be cool ?! ;)

yours
Martin.

Reply via email to