mirror of
https://github.com/nasa/openmct.git
synced 2025-06-19 07:38:15 +00:00
[API] Minimize logic in openmct module
This commit is contained in:
19
openmct.js
19
openmct.js
@ -72,28 +72,17 @@ requirejs.config({
|
|||||||
});
|
});
|
||||||
|
|
||||||
define([
|
define([
|
||||||
'./src/openmct',
|
|
||||||
'./platform/framework/src/Main',
|
'./platform/framework/src/Main',
|
||||||
'./src/defaultRegistry',
|
'./src/defaultRegistry',
|
||||||
'./src/MCT'
|
'./src/MCT'
|
||||||
], function (Main, defaultRegistry, MCT) {
|
], function (Main, defaultRegistry, MCT) {
|
||||||
var mct = new MCT();
|
var openmct = new MCT();
|
||||||
|
|
||||||
mct.legacyRegistry = defaultRegistry;
|
openmct.legacyRegistry = defaultRegistry;
|
||||||
|
|
||||||
mct.run = function (domElement) {
|
openmct.on('start', function () {
|
||||||
if (!domElement) { domElement = document.body; }
|
|
||||||
var appDiv = document.createElement('div');
|
|
||||||
appDiv.setAttribute('ng-view', '');
|
|
||||||
appDiv.className = 'user-environ';
|
|
||||||
domElement.appendChild(appDiv);
|
|
||||||
mct.start();
|
|
||||||
};
|
|
||||||
|
|
||||||
mct.on('start', function () {
|
|
||||||
return new Main().run(defaultRegistry);
|
return new Main().run(defaultRegistry);
|
||||||
});
|
});
|
||||||
|
|
||||||
return mct;
|
return openmct;
|
||||||
|
|
||||||
});
|
});
|
||||||
|
13
src/MCT.js
13
src/MCT.js
@ -194,8 +194,19 @@ define([
|
|||||||
* @fires module:openmct.MCT~start
|
* @fires module:openmct.MCT~start
|
||||||
* @memberof module:openmct.MCT#
|
* @memberof module:openmct.MCT#
|
||||||
* @method start
|
* @method start
|
||||||
|
* @param {HTMLElement} [domElement] the DOM element in which to run
|
||||||
|
* MCT; if undefined, MCT will be run in the body of the document
|
||||||
*/
|
*/
|
||||||
MCT.prototype.start = function () {
|
MCT.prototype.start = function (domElement) {
|
||||||
|
if (!domElement) {
|
||||||
|
domElement = document.body;
|
||||||
|
}
|
||||||
|
|
||||||
|
var appDiv = document.createElement('div');
|
||||||
|
appDiv.setAttribute('ng-view', '');
|
||||||
|
appDiv.className = 'user-environ';
|
||||||
|
domElement.appendChild(appDiv);
|
||||||
|
|
||||||
this.legacyExtension('runs', {
|
this.legacyExtension('runs', {
|
||||||
depends: ['navigationService'],
|
depends: ['navigationService'],
|
||||||
implementation: function (navigationService) {
|
implementation: function (navigationService) {
|
||||||
|
Reference in New Issue
Block a user