A Component prototype property decorator.
Reference a node:
import { Component, Reference } from '@sgrud/shell';
declare global {
interface HTMLElementTagNameMap {
'example-component': ExampleComponent;
}
}
@Component('example-component')
export class ExampleComponent extends HTMLElement implements Component {
@Reference('example-key')
private readonly span?: HTMLSpanElement;
public get template(): JSX.Element {
return <span key="example-key"></span>;
}
}
Generated using TypeDoc
Component prototype property decorator factory. Applying this Reference decorator to a property of a registered Component while supplying the
reference
ing JSX.Key] and, optionally, an array of event names toobserve
, will replace the decorated property with a getter returning thereference
d node, once rendered. If an array of event names is supplied, whenever one of thoseobserve
d events is emitted by thereference
d node, the Component.referenceChangedCallback of the Component is called with thereference
key, thereference
d node and the emitted event.