Skip to content

Instantly share code, notes, and snippets.

@stefanpearson
Created July 6, 2018 15:42
Show Gist options
  • Save stefanpearson/c50fbf8aa2d59d9e672435595260806e to your computer and use it in GitHub Desktop.
Save stefanpearson/c50fbf8aa2d59d9e672435595260806e to your computer and use it in GitHub Desktop.
class Bundle {
load(config) {
const preconfig = this.preconfig(config);
if (typeof preconfig.then === 'function') {
return preconfig.then(resolvedPreconfig => {
this.config = Object.assign({}, this.config, resolvedPreconfig);
this.emit('load', {config: this.config});
});
} else {
this.config = Object.assign({}, this.config, preconfig);
this.emit('load', {config: this.config});
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment