Coralite Type Reference
This document serves as a comprehensive reference for the type definitions used within the Coralite. It outlines the structure, properties, and relationships of core types involved in parsing, rendering, and managing HTML documents, templates, and modules. The following sections provide detailed breakdowns of each type, with tables and internal links for easy navigation.
Core Types #
HTMLData #
Represents HTML file data including path and raw content.
| Property | Type | Description |
|---|---|---|
type |
'page' | 'component' |
The type of HTML file. 'page' for main pages, 'component' for reusable components. |
values |
CoraliteModuleValues |
The initial values for the HTML module. |
path |
CoraliteFilePath |
The file's path information within the project structure. |
content |
string (optional) |
The raw HTML string contents of the file (optional, may be omitted for templates). |
CoraliteFilePath #
Represents a file's path structure within the project.
| Property | Type | Description |
|---|---|---|
pathname |
string |
Full relative path from the project root to the file. |
dirname |
string |
Directory name containing the file. |
filename |
string |
The base file name (including extension). |
CoralitePath #
Defines root directories for pages and components in a Coralite project.
| Property | Type | Description |
|---|---|---|
pages |
string |
The path to the root pages directory. |
components |
string |
The path to the root components directory. |
CoralitePathValues #
Represents URL and file path values available during component rendering.
| Property | Type | Description |
|---|---|---|
$urlPathname |
string |
The URL pathname. |
$urlDirname |
string |
The directory name of the URL. |
$filePathname |
string |
The file path name. |
$fileDirname |
string |
The directory name of the file. |
$filename |
string |
The filename. |
data.values |
Object<string, string> (optional) |
Additional values from data. |
CoraliteValues #
Union type representing values available for token replacement in components.
| Type | Description |
|---|---|
CoralitePathValues |
URL and file path values. |
Object<string, string> |
Key-value pairs for token replacement. |
CoraliteToken #
Represents a token with name and value.
values |
Object<string, string> |
Key-value pairs for token replacement. |
name |
string |
Token identifier. |
content |
string |
Token value or content. |
CoraliteAttributeToken #
Represents an HTML attribute token linked to its parent element.
| Property | Type | Description |
|---|---|---|
name |
string |
Attribute token identifier. |
element |
CoraliteElement |
Corresponding HTML element for the attribute. |
tokens |
CoraliteToken[] |
Array of associated tokens. |
CoraliteRef #
Represents an element reference with name and element.
| Property | Type | Description |
|---|---|---|
name |
string |
Ref identifier. |
element |
CoraliteElement |
Corresponding HTML element for the ref. |
CoraliteTextNodeToken #
Represents a text node token with associated metadata.
| Property | Type | Description |
|---|---|---|
textNode |
CoraliteTextNode |
Text node that contains the token. |
tokens |
CoraliteToken[] |
Array of associated tokens. |
CoraliteModuleValues #
A collection of module values associated with a module.
| Property | Type | Description |
|---|---|---|
| (Key) | CoraliteModuleValue |
Key-value pairs representing module data. |
__script__ |
ScriptContent (optional) |
Script content for the module. |
ScriptContent #
Coralite module script content.
| Property | Type | Description |
|---|---|---|
fn |
function |
The script function. |
values |
Object<string, CoraliteModuleValue> |
Values associated with the script. |
CoraliteModuleValue #
Represents a single value that a module can store or process.
| Type | Description |
|---|---|
string |
A simple string value. |
string[] |
An array of strings. |
CoraliteDirective[] |
Array of directives (e.g., DOCTYPE). |
CoraliteAnyNode[] |
Array of content nodes (elements, text, comments). |
Document and Result Types #
CoraliteDocumentValues #
Holds tokenized metadata extracted from document attributes, element references and text nodes.
| Property | Type | Description |
|---|---|---|
refs |
CoraliteRef[] |
List of element references. |
attributes |
CoraliteAttributeToken[] |
List of attribute tokens from the document. |
textNodes |
CoraliteTextNodeToken[] |
List of text node tokens from the document. |
CoraliteDocumentResult #
Result of document processing containing extracted values and temporary elements.
| Property | Type | Description |
|---|---|---|
values |
CoraliteModuleValues |
The module values extracted from the document. |
tempElements |
CoraliteElement[] |
Temporary elements created during processing. |
CoraliteResult #
Represents a rendered output document with metadata and statistics.
| Property | Type | Description |
|---|---|---|
item |
CoraliteDocument |
The document object from the rendering process. |
html |
string |
Raw HTML content of the render process as a string. |
duration |
number (optional) |
Time taken to render the page in milliseconds. |
CoraliteDocumentRoot #
Represents the root node of a document containing all content nodes.
| Property | Type | Description |
|---|---|---|
type |
'root' |
Node type. |
children |
CoraliteAnyNode[] | CoraliteDirective[] |
Document list of elements, text nodes, or directives. |
CoraliteDocument #
Represents a complete Coralite document with metadata and rendering structure.
| Property | Type | Description |
|---|---|---|
root |
CoraliteDocumentRoot |
Array of elements and text nodes in the document. |
customElements |
CoraliteElement[] |
Custom elements defined in the document. |
path |
CoralitePath & CoraliteFilePath
|
Document's file path. |
ignoreByAttribute |
IgnoreByAttribute[] |
An array of attribute names and values to ignore by element type. |
CoraliteDirective #
Represents a directive found in HTML content, like a DOCTYPE declaration.
| Property | Type | Description |
|---|---|---|
type |
'directive' |
Node type. |
data |
string |
Raw HTML Doctype. |
name |
string |
Doctype name. |
remove |
boolean (optional) |
Mark element to be removed from stack. |
ParseHTMLResult #
Result of parsing HTML content.
| Property | Type | Description |
|---|---|---|
root |
CoraliteDocumentRoot |
The root element of the parsed HTML document. |
customElements |
CoraliteElement[] |
An array of custom elements identified during parsing. |
tempElements |
CoraliteElement[] |
An array of temporary elements created during the parsing process. |
Module and Plugin Types #
CoraliteModule #
A module within the Coralite library, containing metadata and rendering logic.
| Property | Type | Description |
|---|---|---|
id |
string |
Unique module identifier used to reference this module within the application. |
path |
CoraliteFilePath (optional) |
Component paths associated with this module, if any. |
lineOffset |
number (optional) |
Optional offset value for line numbering purposes within the component. |
component |
CoraliteElement |
Module's rendering component which defines its structure and layout. |
script |
string (optional) |
Module's JavaScript raw code used for logic or behavior associated with this module. |
values |
CoraliteDocumentValues |
Values generated from the module's markup, containing metadata or variable information. |
customElements |
CoraliteElement[] |
Custom elements defined in the module, allowing extension of HTML capabilities. |
slotElements |
Object<string, Object<string, CoraliteModuleSlotElement>>
|
Custom slot elements and their configurations, enabling flexible content insertion points within components. |
isComponent |
boolean |
Indicates whether the module is a component. |
CoraliteModuleSlotElement #
Defines a slot element and its configuration within a module.
| Property | Type | Description |
|---|---|---|
name |
string |
Slot element identifier. |
element |
CoraliteElement |
Corresponding HTML element for the slot. |
CoraliteConfig #
Configuration object for Coralite instance.
| Property | Type | Description |
|---|---|---|
output |
string |
The path to the output directory where built files will be placed. |
components |
string |
The path to the directory containing Coralite components. |
pages |
string |
The path to the directory containing pages that will be rendered using the provided components. |
plugins |
CoralitePluginInstance[] (optional) |
Optional array of plugin instances to extend Coralite functionality. |
skipRenderByAttribute |
IgnoreByAttribute[] | string[] (optional) |
An array of attribute names and values to skip rendering. |
standaloneOutput |
string (optional) |
The path to the output directory where standalone client-side web components will be placed. |
CoraliteScriptContent #
Script content for Coralite instances.
| Property | Type | Description |
|---|---|---|
id |
string |
Unique instance identifier. |
componentId |
string (optional) |
Component identifier for shared functions. |
document |
CoraliteDocument |
Coralite document with metadata and rendering structure. |
values |
Object<string, CoraliteModuleValue> (optional) |
Instance values. |
refs |
Object |
Array of reference identifiers. |
CoraliteModuleScript #
Callback for module script execution.
/**
* @callback CoraliteModuleScript
* @param {CoraliteValues} values - The module's current values
* @param {CoraliteRef} refs - References template elements
*/
ClientPlugin #
Configuration for client plugins.
| Property | Type | Description |
|---|---|---|
setup |
function(any): void (optional) |
Called when plugin is registered. |
helpers |
Object<string, function> (optional) |
Global or instance helpers to add to scripts. |
lifecycle |
Object<'register'|'beforeExecute'|'afterExecute'|'onScriptCompile', function>
(optional) |
Lifecycle hooks. |
transform |
function(string, Object): string (optional) |
Transform script content. |
InstanceContext #
Context for Coralite script instances.
| Property | Type | Description |
|---|---|---|
instanceId |
string |
Unique instance identifier. |
componentId |
string |
Component identifier. |
values |
Object<string, CoraliteModuleValue> |
Instance values. |
refs |
Object<string, string> |
Instance refs. |
document |
CoraliteDocument (optional) |
Document context. |
Content Nodes #
CoraliteElement #
Represents a standard HTML element in the Coralite content tree.
| Property | Type | Description |
|---|---|---|
type |
'tag' |
Element type. |
name |
string |
Tag name. |
attribs |
Object<string, string> |
Element attributes. |
helpers |
Object<string, function> (optional) |
Global or instance helpers to add to scripts. |
lifecycle |
Object<'register'|'beforeExecute'|'afterExecute'|'onScriptCompile', function>
(optional) |
Lifecycle hooks. |
transform |
function(string, Object): string (optional) |
Transform script content. |
slots |
Object[] (optional) |
Slot configurations. |
remove |
boolean (optional) |
Mark element to be removed from stack. |
CoraliteTextNode #
Represents a text node within the Coralite content tree.
| Property | Type | Description |
|---|---|---|
type |
'text' |
Text node type. |
data |
string |
Additional attributes for the text node. |
parent |
CoraliteContentNode |
Parent element of the text node. |
remove |
boolean (optional) |
Mark element to be removed from stack. |
CoraliteComment #
Represents an HTML comment within the Coralite content tree.
| Property | Type | Description |
|---|---|---|
type |
'comment' |
Comment type. |
data |
string |
The content of the HTML comment. |
parent |
CoraliteContentNode |
Parent element of the comment node. |
remove |
boolean (optional) |
Mark element to be removed from stack. |
CoraliteAnyNode #
Union type representing any content node (element, text, or comment).
| Type | Description |
|---|---|
CoraliteElement |
A standard HTML element. |
CoraliteTextNode |
A text node within the content tree. |
CoraliteComment |
An HTML comment in the content tree. |
CoraliteContentNode #
Union type representing nodes that can be part of a document's content hierarchy.
| Type | Description |
|---|---|
CoraliteElement |
A standard HTML element. |
CoraliteDocumentRoot |
Root node containing all content nodes. |
Plugins, Collections and Events #
IgnoreByAttribute #
An array of attribute name-value pairs to exclude from processing.
| Property | Type | Description |
|---|---|---|
name |
string |
Name of attribute. |
value |
string |
Value of attribute. |
CoraliteCollectionCallbackResult #
Result value returned from event handlers.
| Property | Type | Description |
|---|---|---|
type |
'page' | 'component' (optional) |
Document type. |
result |
* (optional) |
Result value returned from event handlers. |
CoraliteCollectionItem #
A document object with both HTMLData properties and result handling capabilities.
| Type | Description |
|---|---|
CoraliteCollectionCallbackResult & HTMLData
|
Combines callback results and HTML data. |
CoraliteCollectionEventResult #
Processed value from event handlers.
| Property | Type | Description |
|---|---|---|
value |
* |
The processed value. |
type |
'page' | 'template' (optional) |
Document type. |
id |
string (optional) |
Optional identifier for the item. |
CoraliteCollectionEventSet #
Callback for setting an item in a collection.
/**
* @callback CoraliteCollectionEventSet
* @param {CoraliteCollectionItem} value - Item to be set
* @returns {Promise
CoraliteCollectionEventDelete #
Callback for deleting an item from a collection.
/**
* @callback CoraliteCollectionEventDelete
* @param {CoraliteCollectionItem} value - Item or pathname to delete
* @async
*/
CoraliteCollectionEventUpdate #
Callback for updating an item in a collection.
/**
* @callback CoraliteCollectionEventUpdate
* @param {CoraliteCollectionItem} newValue - New item value
* @param {CoraliteCollectionItem} oldValue - Original item value
* @async
*/
CoralitePluginContext #
Runtime context for plugin execution.
| Property | Type | Description |
|---|---|---|
values |
Object<string, string | string[] | CoraliteAnyNode[]> |
Key-value pairs of data relevant to plugin execution. |
values |
Object<string, CoraliteModuleValue> |
Instance values. |
refs |
Object<string, string> |
Instance refs. |
values |
Object<string, string | string[] | CoraliteAnyNode[]> |
Key-value pairs of data relevant to plugin execution. |
values |
Object<string, string | string[] | CoraliteAnyNode[]> |
Key-value pairs of data relevant to plugin execution. |
param.values |
CoraliteFilePath & Object<string, any> |
Values associated with the page path. |
values |
Object<string, CoraliteModuleValue> |
Values associated with the script. |
CoralitePluginModule #
Execution function that processes content using plugin logic.
/**
* @template T
* @this {ThisType
CoralitePlugin #
Definition of a Coralite plugin.
values |
Object<string, CoraliteModuleValue> |
Instance values. |
refs |
Object<string, string> |
Instance refs. |
values |
Object<string, string | string[] | CoraliteAnyNode[]> |
Key-value pairs of data relevant to plugin execution. |
values |
Object<string, string | string[] | CoraliteAnyNode[]> |
Key-value pairs of data relevant to plugin execution. |
param.values |
CoraliteFilePath & Object<string, any> |
Values associated with the page path. |
values |
Object<string, CoraliteModuleValue> (optional) |
Instance values. |
refs |
Object<string, string> |
Instance refs. |
values |
Object<string, string | string[] | CoraliteAnyNode[]> |
Key-value pairs of data relevant to plugin execution. |
values |
Object<string, string | string[] | CoraliteAnyNode[]> |
Key-value pairs of data relevant to plugin execution. |
param.values |
CoraliteFilePath & Object<string, any> |
Values associated with the page path. |
values |
Object<string, CoraliteModuleValue> (optional) |
Instance values. |
CoralitePluginResult #
Result type for Coralite plugins with generic component parameter.
refs |
Object<string, string> |
Instance refs. |
values |
Object<string, string | string[] | CoraliteAnyNode[]> |
Key-value pairs of data relevant to plugin execution. |
values |
Object<string, string | string[] | CoraliteAnyNode[]> |
Key-value pairs of data relevant to plugin execution. |
param.values |
CoraliteFilePath & Object<string, any> |
Values associated with the page path. |
metadata |
Object (optional) |
Plugin metadata. |
client |
Object (optional) |
Client plugin configuration. |
onPageSet |
CoralitePluginPageSetCallback (optional) |
Async callback triggered when a page is created. |
onPageUpdate |
CoralitePluginPageUpdateCallback (optional)
|
Async callback triggered when a page is updated. |
onPageDelete |
CoralitePluginPageDeleteCallback (optional)
|
Async callback triggered when a page is deleted. |
onComponentSet |
CoralitePluginComponentCallback (optional)
|
Async callback triggered when a component is created. |
onComponentUpdate |
CoralitePluginComponentCallback (optional)
|
Async callback triggered when a component is updated. |
onComponentDelete |
CoralitePluginComponentCallback (optional)
|
Async callback triggered when a component is deleted. |
onBeforePageRender |
CoralitePluginBeforePageRenderCallback
(optional) |
Async callback triggered before page render. |
onBeforeBuild |
CoralitePluginBeforeBuildCallback
(optional) |
Async callback triggered before build starts. |
onAfterBuild |
CoralitePluginAfterBuildCallback
(optional) |
Async callback triggered after build completes. |
CoralitePluginInstance #
A Coralite plugin with associated component data.
| Property | Type | Description |
|---|---|---|
name |
string |
Unique identifier/name of the plugin. |
method |
Function (optional) |
Execution function that processes content using plugin logic. |
components |
HTMLData[] (optional, default: []) |
List of custom components to be included in the coralite instance. |
client |
ClientPlugin (optional) |
Client plugin configuration for extending script functionality. |
onPageSet |
CoralitePluginPageSetCallback (optional) |
Async callback triggered when a page is created. |
onPageUpdate |
CoralitePluginPageUpdateCallback (optional)
|
Async callback triggered when a page is updated. |
onPageDelete |
CoralitePluginPageDeleteCallback (optional)
|
Async callback triggered when a page is deleted. |
onComponentSet |
CoralitePluginComponentCallback (optional)
|
Async callback triggered when a component is created. |
onComponentUpdate |
CoralitePluginComponentCallback (optional)
|
Async callback triggered when a component is updated. |
onComponentDelete |
CoralitePluginComponentCallback (optional)
|
Async callback triggered when a component is deleted. |
onBeforePageRender |
CoralitePluginBeforePageRenderCallback
(optional) |
Async callback triggered before page render. |
onBeforeBuild |
CoralitePluginBeforeBuildCallback
(optional) |
Async callback triggered before build starts. |
onAfterBuild |
CoralitePluginAfterBuildCallback
(optional) |
Async callback triggered after build completes. |
CoralitePluginPageSetCallback #
Async callback triggered when a page is created.
/**
* @this {ThisType
CoralitePluginPageUpdateCallback #
Async callback triggered when a page is updated.
/**
* @this {ThisType
CoralitePluginPageDeleteCallback #
Async callback triggered when a page is deleted.
/**
* @this {ThisType
CoralitePluginComponentCallback #
Async callback triggered for component-related events.
/**
* @this {ThisType
Constructor and Methods #
Constructor #
The Coralite constructor initializes a new instance with configuration options for templates, pages, plugins and ignore attributes.
/**
* @constructor
* @param {Object} options
* @param {string} options.templates - The path to the directory containing Coralite templates.
* @param {CoralitePluginInstance[]} [options.plugins=[]]
* @param {string} options.pages - The path to the directory containing pages that will be rendered using the
provided templates.
* @param {IgnoreByAttribute[]} [options.ignoreByAttribute] - Elements to ignore with attribute name value
pair
* @example
* const coralite = new Coralite({
* templates: './path/to/templates',
* pages: './path/to/pages',
* plugins: [myPlugin],
* ignoreByAttribute: [{ name: 'data-ignore', value: 'true' }]
* });
*/
Constructor Parameters #
| Parameter | Type | Description |
|---|---|---|
options |
Object |
Configuration options for the Coralite instance |
Constructor Options Properties #
| Property | Type | Description |
|---|---|---|
templates |
string |
The path to the directory containing Coralite templates. |
plugins |
CoralitePluginInstance[] |
Optional array of plugin instances to extend Coralite functionality (default: []) |
pages |
string |
The path to the directory containing pages that will be rendered using the provided templates. |
ignoreByAttribute |
IgnoreByAttribute[] |
Elements to ignore with attribute name value pair (default: []) |
Initialise Method #
Initialises the Coralite instance.
/**
* Initialises the Coralite instance.
* @returns {Promise
Returns #
A promise that resolves when the initialization is complete.
Compile Method #
Compiles specified page(s) by rendering their document content and measuring render time. Processes pages based on provided path(s), replacing custom elements with components, and returns rendered results with performance metrics.
/**
* Compiles specified page(s) by rendering their document content and measuring render time.
* Processes pages based on provided path(s), replacing custom elements with components,
* and returns rendered results with performance metrics.
*
* @param {string | string[]} [path] - Path to a single page or array of page paths relative to the pages
directory. If omitted, compiles all pages.
* @return {Promise
Parameters #
| Parameter | Type | Description |
|---|---|---|
path |
string | string[] |
Path to a single page or array of page paths relative to the pages directory. If omitted, compiles all pages. |
Returns #
An array of rendered results with performance metrics.
Save Method #
Saves processed documents as HTML files to the specified output directory.
/**
* Saves processed documents as HTML files to the specified output directory.
* @param {Array
Parameters #
| Parameter | Type | Description |
|---|---|---|
documents |
CoraliteResult[] |
Array of document objects containing metadata and HTML content |
output |
string |
Base directory path where generated HTML files will be saved |
Render Method #
Renders the provided node or array of nodes using the render function. This method serves as an internal utility to handle the rendering process.
/**
* Renders the provided node or array of nodes using the render function.
* This method serves as an internal utility to handle the rendering process.
* @private
* @param {CoraliteDocumentRoot | CoraliteAnyNode | CoraliteAnyNode[]} root - The node(s) to be rendered.
* @returns {string} returns raw HTML
*/
Coralite.prototype._render = function (root) {
}
Parameters #
| Parameter | Type | Description |
|---|---|---|
root |
CoraliteDocumentRoot | CoraliteAnyNode | CoraliteAnyNode[] |
The node(s) to be rendered. |
Returns #
Raw HTML string from the rendering process.
Get Page Paths Using Custom Element #
Retrieves page paths associated with a custom element template.
/**
* Retrieves page paths associated with a custom element template.
*
* @param {string} path - The original path potentially prefixed with the templates directory.
* @returns {string[]} An array of page paths linked to the custom element template.
*/
Coralite.prototype.getPagePathsUsingCustomElement = function (path) {
}
Parameters #
| Parameter | Type | Description |
|---|---|---|
path |
string |
The original path potentially prefixed with the templates directory. |
Returns #
An array of page paths linked to the custom element template.
Add Render Queue #
Adds a page to the current render queue.
/**
* Adds a page to the current render queue.
* @param {string|CoraliteCollectionItem} value - The path to a page or a CoraliteCollectionItem to add to
the render queue.
*/
Coralite.prototype.addRenderQueue = async function (value) {
}
Parameters #
| Parameter | Type | Description |
|---|---|---|
value |
string | CoraliteCollectionItem |
The path to a page or a CoraliteCollectionItem to add to the render queue. |
Create Component #
Creates a component by processing the provided parameters and returning a rendered HTML element.
/**
* @param {Object} options
* @param {string} options.id - id - Unique identifier for the component
* @param {CoraliteModuleValues} [options.values={}] - Token values available for replacement
* @param {CoraliteElement} [options.element] - Mapping of component IDs to their module definitions
* @param {CoraliteDocument} options.document - Current document being processed
* @param {string} [options.contextId] - Context Id
* @param {number} [options.index] - Context index
* @param {boolean} [head=true] - Indicates if the current function call is for the head of the recursion
* @returns {Promise
Parameters #
| Parameter | Type | Description |
|---|---|---|
options.id |
string |
Unique identifier for the component |
options.values |
CoraliteModuleValues |
Token values available for replacement (default: {}) |
options.element |
CoraliteElement |
Mapping of component IDs to their module definitions (optional) |
options.document |
CoraliteDocument |
Current document being processed |
options.contextId |
string |
Context Id (optional) |
options.index |
number |
Context index (optional) |
Returns #
A promise that resolves to a rendered HTML element or void.
Evaluate Method #
Parses a Coralite module script and compiles it into JavaScript.
/**
* Parses a Coralite module script and compiles it into JavaScript.
* @private
* @param {Object} data
* @param {CoraliteModule} data.module - The Coralite module to parse
* @param {CoraliteModuleValues} data.values - Replacement tokens for the component
* @param {CoraliteElement} data.element - The Coralite module to parse
* @param {CoraliteDocument} data.document - The document context in which the module is being processed
* @param {string} data.contextId - Context Id
*
* @returns {Promise
Parameters #
| Parameter | Type | Description |
|---|---|---|
data.module |
CoraliteModule |
The Coralite module to parse |
data.values |
CoraliteModuleValues |
Replacement tokens for the component |
data.element |
CoraliteElement |
The Coralite module to parse |
data.document |
CoraliteDocument |
The document context in which the module is being processed |
data.contextId |
string |
Context Id |
Returns #
A promise that resolves to an object containing compiled JavaScript content.
Module Linker #
Links modules with their file paths for processing.
/**
* @param {CoraliteFilePath} path
* @private
*/
Coralite.prototype._moduleLinker = function (path) {
}
Parameters #
| Parameter | Type | Description |
|---|---|---|
path |
CoraliteFilePath |
The file path information for the module. |
Trigger Plugin Hook #
Executes all plugin callbacks registered under the specified hook name.
/**
* @template {Object} T
* @private
* Executes all plugin callbacks registered under the specified hook name.
* @param
{'onPageSet'|'onPageUpdate'|'onPageDelete'|'onComponentSet'|'onComponentUpdate'|'onComponentDelete'}
name - The name of the hook to trigger.
* @param {T} data - Data to pass to each callback function.
* @return {Promise
Parameters #
| Parameter | Type | Description |
|---|---|---|
name |
'onPageSet'|'onPageUpdate'|'onPageDelete'|'onComponentSet'|'onComponentUpdate'|'onComponentDelete'
|
The name of the hook to trigger. |
data |
T |
Data to pass to each callback function. |
Returns #
A promise that resolves to an array of results from all callbacks.
Add Plugin Hook #
Registers a callback function under the specified hook name.
/**
* Registers a callback function under the specified hook name.
* @private
* @param
{'onPageSet'|'onPageUpdate'|'onPageDelete'|'onComponentSet'|'onComponentUpdate'|'onComponentDelete'}
name - The name of the hook to register the callback with.
* @param {Function} callback - The callback function to be executed when the hook is triggered.
*/
Coralite.prototype._addPluginHook = function (name, callback) {
}
Parameters #
| Parameter | Type | Description |
|---|---|---|
name |
'onPageSet'|'onPageUpdate'|'onPageDelete'|'onComponentSet'|'onComponentUpdate'|'onComponentDelete'
|
The name of the hook to register the callback with. |
callback |
Function |
The callback function to be executed when the hook is triggered. |