As a module author I would like to be able to accept certain options that override default behaviour/characteristics. Currently this can be done manually by throwing keys onto the object passed into the constructor, and retrieving them inside the initialize callback.
var apple = new Apple({
model: { foo: 'bar' },
children: {},
random: 'option'
});
later retrieved inside the module:
initialize: function(config) {
var options = config.options || {};
var random = options.random;
}
This is a little dodgy as this space should be reserved for FruitMachine configuration only. It is not clear to see what is an option specific to this module and what is FruitMachine configuration. I suggest the following:
var apple = new Apple({
module: { foo: 'bar' },
children: {},
options: {
random: 'option'
}
});
later retrieved inside the module:
initialize: function(options, config) {
var random = options.random;
}
As a module author I would like to be able to accept certain options that override default behaviour/characteristics. Currently this can be done manually by throwing keys onto the object passed into the constructor, and retrieving them inside the
initialize
callback.later retrieved inside the module:
This is a little dodgy as this space should be reserved for FruitMachine configuration only. It is not clear to see what is an option specific to this module and what is FruitMachine configuration. I suggest the following:
later retrieved inside the module: