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
referenceing JSX.Key] and, optionally, an array of event names toobserve, will replace the decorated property with a getter returning thereferenced node, once rendered. If an array of event names is supplied, whenever one of thoseobserved events is emitted by thereferenced node, the Component.referenceChangedCallback of the Component is called with thereferencekey, thereferenced node and the emitted event.