Skip to content

Commit

Permalink
Dist
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Brain committed Feb 6, 2019
1 parent 083b132 commit debd8a6
Show file tree
Hide file tree
Showing 13 changed files with 165 additions and 135 deletions.
66 changes: 39 additions & 27 deletions dist/module/parent/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,32 +22,29 @@ var _props = require("./props");
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

class ParentComponent {
// eslint-disable-line flowtype/no-mutable-array
constructor(component, props) {
this.component = void 0;
this.driver = void 0;
this.clean = void 0;
this.event = void 0;
this.initPromise = void 0;
this.handledErrors = void 0;
this.props = void 0;
this.state = void 0;
this.child = void 0;
this.proxyWin = void 0;
this.proxyContainer = void 0;

try {
this.initPromise = new _src3.ZalgoPromise();
this.clean = (0, _src4.cleanup)(this);
this.state = {};
this.component = component;
this.setupEvents(props.onError);
this.setProps(props);
this.component.registerActiveComponent(this);
this.clean.register(() => this.component.destroyActiveComponent(this));
this.watchForUnload();
} catch (err) {
this.onError(err).catch(_src4.noop);
throw err;
}
this.initPromise = new _src3.ZalgoPromise();
this.handledErrors = [];
this.clean = (0, _src4.cleanup)(this);
this.state = {};
this.component = component;
this.setupEvents(props.onError);
this.setProps(props);
this.component.registerActiveComponent(this);
this.clean.register(() => this.component.destroyActiveComponent(this));
this.watchForUnload();
}

setupEvents(onError) {
Expand All @@ -63,7 +60,11 @@ class ParentComponent {
} else if (onError) {
return onError(err);
} else {
throw err;
return this.initPromise.reject(err).then(() => {
setTimeout(() => {
throw err;
}, 1);
});
}
});
}
Expand Down Expand Up @@ -145,7 +146,9 @@ class ParentComponent {
});
return _src3.ZalgoPromise.hash(tasks);
}).catch(err => {
return _src3.ZalgoPromise.all([this.onError(err), this.destroy(err)]);
return _src3.ZalgoPromise.all([this.onError(err), this.destroy(err)]).then(() => {
throw err;
});
}).then(_src4.noop);
}

Expand Down Expand Up @@ -518,7 +521,7 @@ class ParentComponent {
this.child.close.fireAndForget().catch(_src4.noop);
}

return this.destroy(new Error(`Window closed`));
return this.destroy(new Error(`Window closed`), false);
});
}

Expand Down Expand Up @@ -634,23 +637,32 @@ class ParentComponent {
});
}

destroy(err = new Error(`Component destroyed before render complete`)) {
destroy(err, trigger = true) {
return _src3.ZalgoPromise.try(() => {
if (!err) {
trigger = false;
err = new Error('Component destroyed');
}

this.component.log(`destroy`);
this.initPromise.asyncReject(err);
return this.onError(err, trigger);
}).then(() => {
return this.clean.all();
});
}

onError(err) {
// eslint-disable-next-line promise/no-promise-in-callback
onError(err, trigger = true) {
return _src3.ZalgoPromise.try(() => {
if (this.handledErrors.indexOf(err) !== -1) {
return;
}

this.handledErrors.push(err);
this.initPromise.asyncReject(err);
return this.event.trigger(_constants.EVENT.ERROR, err);
}).then(() => {
return this.initPromise;
}).then(() => {
throw err;

if (trigger) {
return this.event.trigger(_constants.EVENT.ERROR, err);
}
});
}

Expand Down
72 changes: 39 additions & 33 deletions dist/zoid.frame.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/zoid.frame.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/zoid.frame.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/zoid.frame.min.js.map

Large diffs are not rendered by default.

72 changes: 39 additions & 33 deletions dist/zoid.frameworks.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/zoid.frameworks.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/zoid.frameworks.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/zoid.frameworks.min.js.map

Large diffs are not rendered by default.

Loading

0 comments on commit debd8a6

Please sign in to comment.