wingspan / wingspan-forms

A dynamic form library for Facebook React, providing abstractions for building dynamic forms and controlled grids. Widgets provided by Telerik's KendoUI.
MIT License
292 stars 25 forks source link

PromiseButton should not support only Q promises #52

Closed newyankeecodeshop closed 10 years ago

newyankeecodeshop commented 10 years ago

PromiseButton should remove the dependency on Q and support any promise implementation that implements then() based on the Promises/A+ specification. This would support direct use of PromiseButton with jQuery and other libraries. It would also remove the need to have wingspan-forms depend on Q.

dustingetz commented 10 years ago

The catch is that PromiseButton calls promise.done(). done() is a Q feature, not part of the promise standard. If we don't call done() unhandled exceptions are swallowed.

newyankeecodeshop commented 10 years ago

Yeah, I'm going to add a prop to control that. So if the promise infrastructure is not Q, there's a way out.

if (this.props.terminateChain) {
     promise.done();
}
newyankeecodeshop commented 10 years ago

Note that now PromiseButton will work with other types of promises, including ES6 Promises, but also supports terminating promise chains as implemented by Q and WinJS.