Fix error in component
helper function
This commit is contained in:
parent
2e0d62b9d1
commit
cc7fcaf1c9
1 changed files with 6 additions and 4 deletions
|
@ -323,7 +323,8 @@ export const component = (name, generator, methods) => {
|
||||||
generator = name
|
generator = name
|
||||||
name = camelToKebab(generator.name)
|
name = camelToKebab(generator.name)
|
||||||
}
|
}
|
||||||
component[kebabToCamel(name)] = class extends HTMLElement{
|
const jsName = kebabToCamel(name)
|
||||||
|
component[jsName] = class extends HTMLElement{
|
||||||
/** @type {ObservableObject} */
|
/** @type {ObservableObject} */
|
||||||
state
|
state
|
||||||
|
|
||||||
|
@ -344,11 +345,12 @@ export const component = (name, generator, methods) => {
|
||||||
if (content) this.replaceChildren(content)
|
if (content) this.replaceChildren(content)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const element = component[jsName]
|
||||||
if (methods) {
|
if (methods) {
|
||||||
Object.defineProperties(Element.prototype, Object.getOwnPropertyDescriptors(methods))
|
Object.defineProperties(element.prototype, Object.getOwnPropertyDescriptors(methods))
|
||||||
}
|
}
|
||||||
customElements.define(name, Element)
|
customElements.define(name, element)
|
||||||
return Element;
|
return element;
|
||||||
}
|
}
|
||||||
|
|
||||||
class Composition extends ObservableValue {
|
class Composition extends ObservableValue {
|
||||||
|
|
Loading…
Reference in a new issue