-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathGenericModule.js
More file actions
31 lines (28 loc) · 1.1 KB
/
GenericModule.js
File metadata and controls
31 lines (28 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/**
* @class GenericModule
*
* @author Stefano Sergio
*/
//XXX this module will be just a concrete implementation of AbstractModule
Refuel.define('GenericModule',{inherits: 'AbstractModule'},
function GenericModule() {
var config = {};
this.init = function(myConfig) {
config = Refuel.mix(config, myConfig);
delete config['data'];
if (config.root) {
this.template.setRoot(config.root);
this.template.parseTemplate();
}
if (this.dataSource) {
//console.log(config.dataLabel, Refuel.refuelClass(this),'have dataSource and is waiting for data...');
this.dataSource.subscribe('dataAvailable', function(data) {
//console.log(config.dataLabel, Refuel.refuelClass(this),'got all data (dataAvailable), now he can draw()');
this.notify('loadComplete');
this.draw();
this.notify('drawComplete');
}, this);
this.dataSource.init(config);
}
}
});