Enhancement Namespaces - sjonesyodle/Cluster GitHub Wiki
By default, all enhancements are added to this.cluster.X namespace. This is done to relieve conflicts with other property names within Modules.
By setting the mergeEnhancements or merge Boolean to true, you can tell Cluster to add each enhancement property to the Module itself: this.X.
Example 1 - Default Behavior
var myApp = Cluster();
myApp.enhance({
coolFunction: function(x){
console.log(x);
}
});
myApp.collect({
init: function(){
this.cluster.coolFunction("Works!");
}
}).start();
Example 2 - merge Behavior
var myApp = Cluster({
merge: true
});
myApp.enhance({
coolFunction: function(x){
console.log(x);
}
});
myApp.collect({
init: function(){
this.coolFunction("Works!");
}
}).start();