[Selection] Go through openmct API

This commit is contained in:
Victor Woeltjen
2016-09-23 15:07:03 -07:00
parent 4ce952846c
commit c411f8fbe3
3 changed files with 17 additions and 11 deletions

View File

@ -28,12 +28,12 @@
<script src="bower_components/requirejs/require.js"> <script src="bower_components/requirejs/require.js">
</script> </script>
<script> <script>
require(['main'], function (mct) { require(['main'], function (openmct) {
require([ require([
'./example/imagery/bundle', './example/imagery/bundle',
'./example/eventGenerator/bundle', './example/eventGenerator/bundle',
'./example/generator/bundle' './example/generator/bundle'
], mct.run.bind(mct)); ], openmct.start.bind(openmct));
}); });
</script> </script>
<link rel="stylesheet" href="platform/commonUI/general/res/css/startup-base.css"> <link rel="stylesheet" href="platform/commonUI/general/res/css/startup-base.css">

16
main.js
View File

@ -68,6 +68,7 @@ requirejs.config({
}); });
define([ define([
'./src/openmct',
'./platform/framework/src/Main', './platform/framework/src/Main',
'legacyRegistry', 'legacyRegistry',
@ -105,12 +106,11 @@ define([
'./platform/entanglement/bundle', './platform/entanglement/bundle',
'./platform/search/bundle', './platform/search/bundle',
'./platform/status/bundle', './platform/status/bundle',
'./platform/commonUI/regions/bundle' './platform/commonUI/regions/bundle',
], function (Main, legacyRegistry) { './src/adapter/legacyBundle'
return { ], function (openmct, Main, legacyRegistry) {
legacyRegistry: legacyRegistry, openmct.legacyRegistry = legacyRegistry;
run: function () { openmct.on('start', function () {
return new Main().run(legacyRegistry); return new Main().run(legacyRegistry);
} });
};
}); });

View File

@ -21,24 +21,28 @@
*****************************************************************************/ *****************************************************************************/
define([ define([
'EventEmitter',
'./selection/Selection', './selection/Selection',
'./selection/ContextManager', './selection/ContextManager',
'./selection/SelectGesture', './selection/SelectGesture',
'./ui/menu/ContextMenuGesture', './ui/menu/ContextMenuGesture',
'./ui/ViewRegistry' './ui/ViewRegistry'
], function ( ], function (
EventEmitter,
Selection, Selection,
ContextManager, ContextManager,
SelectGesture, SelectGesture,
ContextMenuGesture, ContextMenuGesture,
ViewRegistry ViewRegistry
) { ) {
var openmct = {}; var openmct = Object.create(EventEmitter.prototype);
var selection = new Selection(); var selection = new Selection();
var manager = new ContextManager(); var manager = new ContextManager();
var select = new SelectGesture(manager, selection); var select = new SelectGesture(manager, selection);
var contextMenu = new ContextMenuGesture(selection, {}, {}, manager); var contextMenu = new ContextMenuGesture(selection, {}, {}, manager);
EventEmitter.call(openmct);
openmct.selection = selection; openmct.selection = selection;
openmct.inspectors = new ViewRegistry(); openmct.inspectors = new ViewRegistry();
@ -48,5 +52,7 @@ define([
contextual: contextMenu.apply.bind(contextMenu) contextual: contextMenu.apply.bind(contextMenu)
}; };
openmct.start = openmct.emit.bind(openmct, 'start');
return openmct; return openmct;
}); });