You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Quick and dirty example of the concept of thenables which would be cross browser compatible - the use of promises would not: https://caniuse.com/#feat=promises
async function getData()
{
var callbacks = { resolve: undefined, reject: undefined };
var promise = { then: function(resolve, reject) { callbacks.resolve = resolve; callbacks.reject = reject; } };
setTimeout(function() { callbacks.resolve("Hello world"); }, 2000);
return promise;
}
// Test using .then(..)
getData().then(function(res) { console.log("Thenable result: ", res); });
// Test using await
var result = await getData();
console.log("Awaited result: ", result);
The text was updated successfully, but these errors were encountered:
Closed as this was obviously a bad idea since we cannot mark functions as async since IE does not support this. So functionality within Fit.UI should not be async and return promises by default.
However, having some sort of Promise/Thenable object that is compatible with the native implementation might make sense at some point.
Async. operations such as HTTP Requests should return a thenable or promise to support await and .then(..).
A good article on the subject can be found here:
https://developers.google.com/web/fundamentals/primers/promises
Quick and dirty example of the concept of thenables which would be cross browser compatible - the use of promises would not: https://caniuse.com/#feat=promises
The text was updated successfully, but these errors were encountered: