UNPKG

mframejs

Version:
90 lines (53 loc) 1.55 kB
import { IControllerArray, IBindingContext } from './exported'; import { ElementController } from '../view/exported'; export interface IElement { /** * showdow DOM if any */ $shadowdom?: Node | Element | HTMLElement; /** * DOM Element to the custom element */ $element?: Node | Element | HTMLElement; /** * DOM attributes on Element */ $attributes?: NamedNodeMap; /** * binding context */ $bindingContext?: IBindingContext; /** * controller */ $controller?: ElementController; /** * mandatory( one of them), need to return template * all helper variables are set here */ loadTemplate?(): string | Promise<string>; /** * when created, and $element etc is set */ created?(templateNode?: Node | Element): void; /** * middleware, incase you want to mess with it * important to return true/false */ processContent?(templateNode?: Node | Element): boolean; /** * middleware, get controllers of content processed * content are added to element, but attached is not called on any of them */ contentProcessed?(controllers?: IControllerArray): void; /** * element will be attached/connected to parent when this is called * Good place to call addEventlister */ attached?(): void; /** * when element node is about to be detached from parent * Good place to call removeEventlister/clean up */ detached?(): void; }