import { Component } from 'preact'
import register from 'preact-custom-element'
class Test extends Component {
constructor() {
super()
this.state = { value: -1 }
}
getValue() {
return this.state.value
}
// ...
}
register(Test, 'x-test')
Error:
<x-test id="test1"></x-test>
// ...
document.getElementById('test1').getValue() // VM168:1 Uncaught TypeError: document.getElementById(...).getValue is not a function
Custom elements are missing component methods.
Example:
Error:
This PR is an attempt at fixing the issue.