forked from Jibo-Revival-Group/JiboOs
73 lines
3.4 KiB
JavaScript
73 lines
3.4 KiB
JavaScript
/**
|
|
* Utility methods for registering activities and creating flows.
|
|
* @class FlowExecutorFactory
|
|
* @namespace jibo.flow
|
|
*/
|
|
|
|
/**
|
|
* Register an activity globally
|
|
* @method jibo.flow#register
|
|
* @param {String} name The PascalCased name for the behavior.
|
|
* @param {String} namespace This behavior's namespace. Pass in a globally unique name for this namesapce.
|
|
* @param {Module} classRef Class reference for the behavior or decorator.
|
|
*/
|
|
|
|
/**
|
|
* Add all activities
|
|
* @method jibo.flow#registerCore
|
|
* @private
|
|
*/
|
|
|
|
/**
|
|
* Give the Flow Executor access to the Activity constructors.
|
|
* @param {string} className - Final Class name (e.g. `FlowEvalAsync`)
|
|
* @param {string} [namespace] - Namespace of activity -- `core` if unsupplied.
|
|
* @returns {jibo.flow.ActivityImplementation} - Constructor of the activity or undefined if not found.
|
|
*/
|
|
|
|
/**
|
|
* Create a runnable flow executor from a flow file import.
|
|
* @method jibo.flow#create
|
|
* @param {String|Function} uri Relative or absolute path to a `.flow` file or module export of flow.
|
|
* @param {FlowExecutorOverrides} [overrides] Options for populating flow globals.
|
|
* @returns {jibo.flow.FlowExecutor}
|
|
*/
|
|
|
|
/**
|
|
* Create and run a runnable flow from a flow file import.
|
|
* ```
|
|
* const jibo = require('jibo');
|
|
* jibo.init('face', (err) => {
|
|
* jibo.flow.run('./flows/main', function(status){});
|
|
* });
|
|
*
|
|
* // Other supported APIs
|
|
* jibo.flow.run('./flows/main');
|
|
* jibo.flow.run('./flows/main', (status) => {});
|
|
* const overrides = {};
|
|
* jibo.flow.run('./flows/main', overrides);
|
|
* jibo.flow.run('./flows/main', overrides, (status) => {});
|
|
* ```
|
|
*
|
|
* @method jibo.flow#run
|
|
* @param {String|Function} uri Relative or absolute path to a `.flow` file or module export of flow.
|
|
* @param {Object} [overrides] Used for supplying optional flow globals and setting FlowExecutor options.
|
|
* @param {jibo.bt.Blackboard} [overrides.blackboard] Override the default blackboard object for this flow.
|
|
* @param {Object} [overrides.notepad] Provide your own notepad object instead of the default one.
|
|
* @param {Object} [overrides.blackboard] Provide your own blackboard object instead of the default one shared with behavior trees.
|
|
* @param {Object} [overrides.emitter] Provide your own emitter object instead of the default one shared with behavior trees.
|
|
* @param {String} [overrides.assetPack] The asset pack name to use for loading assets in this tree.
|
|
* @param {boolean} [overrides.stopOnException] Set to true to cause the FlowExecutor to stop in the debugger with an explorable stacktrace.
|
|
* @param {boolean} [overrides.enableLogging] Set to true to cause the FlowExecutor to log an activity trace to the console as it executes.
|
|
* @param {function} onFinishedCallback The callback which gets called when the flow has reached a status of FAILED, SUCCEEDED, or INTERRUPTED.
|
|
* @returns {jibo.flow.FlowExecutor}
|
|
*/
|
|
|
|
/**
|
|
* Resolve the path in relation to a calleeDirname directory. If the supplied uri is an absolute path, the uri is
|
|
* returned unmodified.
|
|
* @param {String} calleeDirname The directory name where the uri is relative to.
|
|
* @param {String} uri The relative or absolute uri to a file in relation to the calleeDirname.
|
|
* @returns {String} The result absolute path.
|
|
* @private
|
|
*/ |