signalizejs/directives
Attribute Directives inspired by Vue and Svelte.
Directives can be used only within web components and are initialized on DOM ready and after the component is constructed.
Installation
Required import map dependencies:
const {
directive,
getPrerenderedNodes,
processDirectives
} = await signalize.resolve('directives');
/*
If you do not want to use any directives module functions but still want to use the directives on elemnents,
simply resolve it to initialize the module.
*/
await signalize.resolve('directives');
Javascript Evaluation
Directives use javascript javascript evaluator
- This evaluator is able to process only inline javascript.
- There is no
unsafe eval(eval, new Function, Async function Prototype). - It doesn’t support full javascript syntax. Make sure to read about the supported syntax.
Passing data to directives from Web Components
To pass data to the directives, return the data from a component setup. Any created property will also be passed to the directives as data:
__CODE__