Cluster Options - sjonesyodle/Cluster GitHub Wiki

Draft

Each Cluster instance accepts options, in the form of an Object-Literal, that change the behavior of the Cluster and it's Modules. Options are passed when defining a Cluster instance:

var myApp = Cluster({ /* Options */ });

Options

mergeEnhancements || merge - Boolean

Set to true to add any enhancements to the this namespace (rather than the this.cluster namespace) for each module (read more here). Default: false.


debug - Boolean

Setting to true will log all of the modules and messages registered in the Cluster, as well as any conflicts with mergeEnhancments. Default: false.


beforeInit - Function or Array of Functions

For cases where a function (or group of functions) need to run on all Modules before the .call() method initiates.


afterInit - Function or Array of Functions

For cases where a function (or group of functions) need to run on all Modules after the .call() method initiates.

Functions defined for both beforeInit and afterInit are automatically called in the context of each Module as they are instantiated, giving them access to each Module's this keyword.