-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodule.d.ts
More file actions
37 lines (32 loc) · 968 Bytes
/
Copy pathmodule.d.ts
File metadata and controls
37 lines (32 loc) · 968 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// module.d.ts (template for custom modules)
/**
* Standard module structure for DOMule
* Use this as reference when creating new modules
*/
/**
* Module name (required for logging)
*/
export const NAME: string;
/**
* Initialization function (required)
* Called by DOMule after module import
*
* @param elements - All elements with data-requires for this module
* @returns Optional status message or boolean
*/
export function init(elements: NodeList | HTMLElement[]): string | boolean | void;
/**
* Module API (optional)
* Enables inter-module coordination via ModuleRegistry
*
* @param action - Action name (getState, onChange, etc.)
* @param args - Action-specific arguments
* @returns Action-specific return value
*/
export function api(action: string, ...args: any[]): any;
/**
* Cleanup function (optional)
* Called before module unregistration
* Remove listeners, disconnect observers, clear timers
*/
export function destroy(): void;