openmct/src/MCT.js

32 lines
828 B
JavaScript
Raw Normal View History

2016-05-27 13:31:30 -07:00
define([
'EventEmitter',
'legacyRegistry',
'./api/api'
], function (EventEmitter, legacyRegistry, api) {
2016-05-27 11:49:43 -07:00
function MCT() {
EventEmitter.call(this);
2016-05-27 13:31:30 -07:00
this.legacyBundle = { extensions: {} };
2016-05-27 11:49:43 -07:00
}
MCT.prototype = Object.create(EventEmitter.prototype);
2016-05-27 13:31:30 -07:00
Object.keys(api).forEach(function (k) {
MCT.prototype[k] = api[k];
});
MCT.prototype.type = function (key, type) {
var legacyDef = type.toLegacyDefinition();
legacyDef.key = key;
this.legacyBundle.extensions.types =
this.legacyBundle.extensions.types || [];
this.legacyBundle.extensions.types.push(legacyDef);
};
2016-05-27 11:49:43 -07:00
MCT.prototype.start = function () {
2016-05-27 13:31:30 -07:00
legacyRegistry.register('adapter', this.legacyBundle);
2016-05-27 11:49:43 -07:00
this.emit('start');
};
return MCT;
});