$methods
Updated on Aug 29, 2025 2 minutes to readThe Methods Plugin provides a simple registry for user-defined functions, allowing developers to store and invoke custom methods globally within the application.
Methods
Method | Description |
---|---|
call | Invokes a previously registered custom method by name, passing optional args. |
set | Registers a new custom method by name if it does not already exist. |
Methods Details
call()
• Type
(name: string, ...args: any[]) => any
• Details
Invokes a previously registered method from the cache. If the method is not found, an error is logged in the console. Arguments passed after the method name will be forwarded to the registered function.
• Example
E8App.$methods.call('myFunc', 'Hello', 'world');
set()
• Type
(name: string, callback: Function) => void
• Details
Registers a new custom method under the given name. If the method name is already registered, the function will not overwrite it. Only valid functions (typeof func === 'function') are accepted.
• Example
E8App.$methods.set('myFunc', (arg1, arg2) => {
console.log(arg1, arg2);
});