UNPKG

@surface/custom-element

Version:

Provides support of directives and data binding on custom elements.

21 lines (20 loc) 874 B
import type { IDisposable } from "@surface/core"; import type { Subscription } from "@surface/observer"; import type DirectiveContext from "../types/directive-context.js"; export default abstract class Directive implements IDisposable { protected readonly context: DirectiveContext; protected readonly subscription: Subscription; protected readonly keySubscription: Subscription; protected key: string; protected value: unknown; constructor(context: DirectiveContext); private keyNotify; private valueNotify; protected onAfterBind?(): void; protected onAfterUnbind?(): void; protected onBeforeBind?(): void; protected onBeforeUnbind?(): void; protected onKeyChange?(newKey: string, oldKey: string): void; protected onValueChange?(newValue: unknown, oldValue: unknown): void; dispose(): void; }