padolsey/operative — pull request #7 by padolsey (2013-07-22 16:22:52+00:00)
Title: Promises Support

This enables Operative to return a promise for async operatives (per [native Promise API](http://dom.spec.whatwg.org/#concept-resolver-fulfill)).

The branch has been tested with the [slightlyoff/Promises](https://github.com/slightlyoff/Promises/tree/master/polyfill) polyfill.

E.g.

```js
var combine = operative(function(foo, bar) {
// Internally, use a Deferred:
var deferred = this.deferred();

// A deferred has two methods: fulfill & reject:

if (foo !== 'foo') {
// Error (Rejection)
deferred.reject('foo should be "foo"!');
} else {
// Success (Filfillment)
deferred.fulfill(foo + bar);
}
});

// Usage externally:
var promise = combine('foo', 'bar');

promise.then(function(value) {
// Fulfilled
}, function(err) {
// Rejected
});
```

As you can see this branch also includes support for `operative(Function)` in additional to the already supported `operative(Object)`.

Note that operative will only return a Promise IF:

* You don't pass a callback
* `operative.Promise` is defined (by default `=== window.Promise`)

*So, you'll have to include the aforementioned polyfill (or similar) to use this feature in most envs*

Ref Issue #3, Issue #2