@jetjs/core
class PluginReader
Methods
Method | Return | Description |
---|---|---|
findAll(element) | HTMLElement[] | |
readDefinition(element) | string | |
readParameter(element, name) | PluginParameter |
Method Details
-
findAll(element) Method
Signature:findAll(element: HTMLElement): HTMLElement[];
Returns:HTMLElement[]
Parameter Type Description element HTMLElement
-
readDefinition(element) Method
Reads a plugin definition from the given element. But it doesn't parse the definition or validate if it is a valid plugin definition
Signature:readDefinition(element: HTMLElement): string;
Returns:string
Parameter Type Description element HTMLElement
the element to read the plugin definition from
throws an Error if the plugin definition wasn't found
-
readParameter(element, name) Method
Reads the parameter for the plugin with the given name from the given element
Signature:readParameter(element: HTMLElement, name: PluginName): PluginParameter;
Returns:PluginParameter
plugin parameter object. will be an empty object if no parameters found
e.g.: html:
<div data-plugins="p1" data-p1-foo="bar" data-p1-some-key="value">...</div>
readPluginParameter(div, 'p1') returns: { foo: "bar", someKey: "value" }
Parameter Type Description element HTMLElement
element to read the parameter from
name PluginName
name from the plugin, to read the parameter for