Add UNFORGIVING mode

* This will explicitly throw errors instead of handling them through
  Event Listeners
This commit is contained in:
Piper
2026-08-16 16:56:10 +02:00
parent 8a95e0f98a
commit 19794ec27f
+8 -4
View File
@@ -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();
@@ -194,7 +198,7 @@ class TemplateE6d extends HTMLTemplateElement {
injectTarget.data = dataValue;
}
}
return [templated, references,];
}