0.1.4 • Published 12 years ago

defactor v0.1.4

Weekly downloads
36
License
-
Repository
github
Last release
12 years ago

Defector - A Deferred Factory Object

Defector allows creating deferred objects with a many-to-many relationship between queues and resolvers. By creating this type of event map there shouldn't be a need for callback insanity. Here's an example:

var dobj = defactor();

dobj.add( 'done', 'resolve' )
	.add( 'fail', 'reject' )
	.add( 'always', 'resolve' )
	.add( 'always', 'reject' );

var defer = dobj.create();

defer.done(function() {
		console.log( 'done' );
	})
	.fail(function() {
		console.log( 'fail' );
	})
	.always(function() {
		console.log( 'always' );
	});

defer.resolve();    // LOG: "done"; "always"

Roadmap:

  • add the promise() method to each deferred
  • allow addWith() to create queue/resolver pairs that accept a new context
  • create() should return an uninstantiated deferred
  • add always() method to create a queue that is always fired
  • add then() that accepts two queues and resolvers
0.1.4

12 years ago

0.1.3-1

12 years ago

0.1.3

12 years ago

0.1.2

12 years ago

0.1.1

12 years ago

0.1.0

12 years ago

0.0.5

12 years ago

0.0.4

12 years ago

0.0.3

12 years ago

0.0.2

12 years ago

0.0.1

12 years ago