Reduce the need for Babel polyfills

=== smaller files.
This commit is contained in:
Timothy Farrell 2016-12-27 22:09:13 -06:00
parent 342c46df6f
commit a53bc7f013

View File

@ -42,7 +42,9 @@ export function WorkerPortal(context, worker, isSlave, serialize) {
} catch (e) {
data = evt.data;
}
const [type, destination, id, params] = data;
const destination = data[1];
const id = data[2];
const params = data[3];
function _resolve(value) {
post(1, id, 0, value);
@ -52,7 +54,7 @@ export function WorkerPortal(context, worker, isSlave, serialize) {
}
// If we have received an RPC response, satisfy the promise.
if (type) {
if (data[0]) {
if (responseMap.has(id)) {
const responses = responseMap.get(id);
responseMap.delete(id);
@ -121,8 +123,9 @@ export function WorkerPortal(context, worker, isSlave, serialize) {
});
}
return injectionPointFactory(0, resolveExternalInterfaceFactory)(contextIndex).then(api => ({
...api,
_cleanup: injectionPointFactory(1, resolve => resolve(cleanup()))
}));
return injectionPointFactory(0, resolveExternalInterfaceFactory)(contextIndex).then(api =>
Object.assign(api, {
_cleanup: injectionPointFactory(1, resolve => resolve(cleanup()))
})
);
}