finally_ method
Implementation
JSPromise finally_(Function onFinally) {
return then((v) {
try {
final r = onFinally([]);
if (r is JSPromise) {
return r.then((_) => v);
}
return v;
} catch (e) {
throw e;
}
}, (e) {
try {
final r = onFinally([]);
if (r is JSPromise) {
return r.then((_) => throw e);
}
throw e;
} catch (err) {
throw err;
}
});
}