mirror of
https://github.com/nasa/openmct.git
synced 2025-06-20 16:10:23 +00:00
[API] Move type toward a newer API
This commit is contained in:
20
src/MCT.js
20
src/MCT.js
@ -1,11 +1,29 @@
|
||||
define(['EventEmitter'], function (EventEmitter) {
|
||||
define([
|
||||
'EventEmitter',
|
||||
'legacyRegistry',
|
||||
'./api/api'
|
||||
], function (EventEmitter, legacyRegistry, api) {
|
||||
function MCT() {
|
||||
EventEmitter.call(this);
|
||||
this.legacyBundle = { extensions: {} };
|
||||
}
|
||||
|
||||
MCT.prototype = Object.create(EventEmitter.prototype);
|
||||
|
||||
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);
|
||||
};
|
||||
|
||||
MCT.prototype.start = function () {
|
||||
legacyRegistry.register('adapter', this.legacyBundle);
|
||||
this.emit('start');
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user