Given a Ajax request in AngularJS $http.get("/backend/").success(callback); what is the most effective way to cancel that request if another request is launched (same backend, different parameters for instance). 8...
I’m still struggling with promises, but making some progress thanks to the community here. I have a simple JS function which queries a Parse database. It’s supposed to return...
I’ve been messing around with the fetch() api recently, and noticed something which was a bit quirky. let url = "http://jsonplaceholder.typicode.com/posts/6"; let iterator = fetch(url); iterator .then(response => {...
I have got a javascript code like this: function justTesting() { promise.then(function(output) { return output + 1; }); } var test = justTesting(); I have got always an undefined...
I have a pure JavaScript Promise (built-in implementation or poly-fill): var promise = new Promise(function (resolve, reject) { /* ... */ }); From the specification, a Promise can be...
Node.js from version 7 has async/await syntactic sugar for handling promises and now in my code the following warning comes up quite often: (node:11057) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection...
My code: let AuthUser = data => { return google.login(data.username, data.password).then(token => { return token } ) } And when i try to run something like this: let userToken...
Want to improve this post? Provide detailed answers to this question, including citations and an explanation of why your answer is correct. Answers without enough detail may be edited...
I had a look at the bluebird promise FAQ, in which it mentions that .then(success, fail) is an antipattern. I don’t quite understand its explanation as for the try...
I’ve just finished reading the Promises/A+ specification and stumbled upon the terms microtask and macrotask: see http://promisesaplus.com/#notes I’ve never heard of these terms before, and now I’m curious what...