Add UNFORGIVING mode
* This will explicitly throw errors instead of handling them through Event Listeners
This commit is contained in:
@@ -4,11 +4,18 @@ class TemplateE6d extends HTMLTemplateElement {
|
||||
this.preprocessed = false;
|
||||
}
|
||||
|
||||
connectedCallback() {
|
||||
this.unforgiving = this.hasAttribute(`data-e6d-unforgiving`);
|
||||
}
|
||||
|
||||
dispatchError(type, detail) {
|
||||
const evtBroad = new CustomEvent(`e6d-error`, {detail,});
|
||||
const evtSpecific = new CustomEvent(`e6d-error-${ type }`, {detail,});
|
||||
this.dispatchEvent(evtBroad);
|
||||
this.dispatchEvent(evtSpecific);
|
||||
if (this.unforgiving) {
|
||||
throw new Error(`${ type }: ${ JSON.stringify(detail) }`);
|
||||
}
|
||||
}
|
||||
|
||||
preprocess() {
|
||||
@@ -122,9 +129,6 @@ class TemplateE6d extends HTMLTemplateElement {
|
||||
this.preprocessed = true;
|
||||
}
|
||||
|
||||
connectedCallback() {
|
||||
}
|
||||
|
||||
bind(obj = {}) {
|
||||
this.preprocess();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user