Commit cab7d4f1 authored by Stefan Penner's avatar Stefan Penner

pre-allocate the deferred's shape

This allows the VM to optimize correctly.
parent a39f0734
import { Promise } from "./promise";
function defer() {
var deferred = {};
var deferred = {
// pre-allocate shape
resolve: undefined,
reject: undefined,
promise: undefined
};
var promise = new Promise(function(resolve, reject) {
deferred.promise = new Promise(function(resolve, reject) {
deferred.resolve = resolve;
deferred.reject = reject;
});
deferred.promise = promise;
return deferred;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment