import type Application from "./../application/application.ts"; /** * Contains all registered plugins. */ export declare const cache: Record; /** * @namespace plugin */ /** * a base Object class for plugin * (plugin must be installed using the register function) */ export declare class BasePlugin { /** * define the minimum required version of melonJS * this can be overridden by the plugin */ version: string; /** * a reference to the app/game that registered this plugin */ app: Application; constructor(app?: Application); } /** * patch a melonJS function * @param proto - target object * @param name - target function * @param fn - replacement function * @example * // redefine the app.update function with a new one * me.plugin.patch(app, "update", function () { * // display something in the console * console.log("duh"); * // call the original app.update function * this._patched(); * }); */ export declare function patch(proto: Record, name: string, fn: (...args: any[]) => any): void; /** * Register a plugin. * @param pluginClass - Plugin class to instantiate and register * @param name - a unique name for this plugin * @param args - all extra parameters will be passed to the plugin constructor * @example * // register a new plugin * me.plugin.register(TestPlugin, "testPlugin"); * // the `testPlugin` class instance can also be accessed through me.plugin.cache * me.plugin.cache.testPlugin.myfunction (); */ export declare function register(pluginClass: new (...args: any[]) => BasePlugin, name?: string, ...args: any[]): void; /** * returns the plugin instance with the specified class type or registered name * @param classType - the Class Object or registered name of the plugin to retrieve * @returns a plugin instance or undefined */ export declare function get(classType: string | (new (...args: any[]) => BasePlugin)): BasePlugin | undefined; //# sourceMappingURL=plugin.d.ts.map