60 lines
1.9 KiB
TypeScript
60 lines
1.9 KiB
TypeScript
/**
|
|
* Callback for initializing a plugin.
|
|
* @callback module:jibo.Plugin~PluginCallback
|
|
* @param {String|Error} [err] Optional error if init failed.
|
|
* @param {Object} [api] Optional api to assign to the jibo runtime.
|
|
*/
|
|
export declare type PluginCallback = (err?: string | Error, api?: any) => void;
|
|
export interface PluginConstructor {
|
|
new (): Plugin;
|
|
}
|
|
/**
|
|
* List of jibo's internal plugins are below. These can be referenced
|
|
* by name when register a plugin with the "depends" option to ensure
|
|
* that plugin is create and initialized before the plugin can be used.
|
|
*
|
|
* - anim-utils - Setup the animation utilities
|
|
* - dof-arbiter - Setup the Emotion Manager
|
|
* - fonts - Install the system fonts
|
|
* - lifecycle - Install the lifecycle API
|
|
* - rendering - Setup the renderer
|
|
* - registry - Get the registry from SSM
|
|
* - service-records - Get the list of services from SSM
|
|
* - services - Setup the services
|
|
* - versions - Get the list of versions
|
|
* - loader - Setup the loader API
|
|
* - sound - Setup the sound API
|
|
*/
|
|
/**
|
|
* Class to create custom code that's instantiated with `jibo`. For instance:
|
|
* ```
|
|
* import Runtime from './Runtime';
|
|
* class NameTagPlugin implements jibo.Plugin {
|
|
* public whoAmI(): void {
|
|
* console.log('my name is jibo');
|
|
* }
|
|
* }
|
|
* Runtime.registerPlugin(NameTagPlugin, 'nameTag', {
|
|
* api: true
|
|
* });
|
|
* ```
|
|
* @class Plugin
|
|
* @memberof module:jibo
|
|
* @intdocs
|
|
*/
|
|
export interface Plugin {
|
|
/**
|
|
* If provided, then this is chosen as the actual plugin instance used in the api
|
|
* @name module:jibo.Plugin#api
|
|
* @type {Object}
|
|
*/
|
|
api?: any;
|
|
/**
|
|
* Initialize the plugin when jibo is initialized. Optional to override intialization.
|
|
* @method module:jibo.Plugin#init
|
|
* @param {Callback} callback The asynchronous callback.
|
|
*/
|
|
init(done: PluginCallback): void;
|
|
}
|
|
export default Plugin;
|