3 ms·
Actually, there are already monadic interfaces for Javascript async code with widespread use. Promises! http://dojotoolkit.org/reference-guide/dojo/Deferred.ht
by ufo 15y ago
Actually, there are already monadic interfaces for Javascript async code with widespread use. Promises!
http://dojotoolkit.org/reference-guide/dojo/Deferred.html http://dojotoolkit.org/reference-guide/dojo/Deferred.html
http://api.jquery.com/category/deferred-object/ http://api.jquery.com/category/deferred-object/
new deferred objects can be created manually or obtained from say, an AJAX function (this is the equivalent of "return")
async operations can be chained with the deferred.then method (this is a hybrid of "fmap" and ">>=", aka "bind")