what is the difference between thunk, futures, and promises?

An example of each, using javascript since everybody can read it. Please don’t use this code in production, use a real library, there are plenty of good ones. var a, b, c, async_obj; // assume exist // CommonJS – for reference purposes try { async_obj.asyncMethod(a, b, c, function (error1, result1) { if (error1) { console.error(error1); … Read more

Promises without `.then`

Conceptually, there’s nothing wrong with an operation that only has an error handler and has nothing else to do upon successful completion. If that’s all it needs, then that’s fine. For example, suppose you’re updating a server with some new data from the client. If the data is successfully sent to the server, there’s nothing … Read more

When should we use .then with Protractor Promise?

The answer of this question can be found in this post : http://spin.atomicobject.com/2014/12/17/asynchronous-testing-protractor-angular/ That is : Protractor enqueue all driver commands in the ControlFlow, when you need the result of a driver command you should use .then, when you don’t need the result of a driver you can avoid .then but all following instructions must … Read more