mirror of
https://github.com/nasa/openmct.git
synced 2025-06-16 14:18:16 +00:00
[API] Fix explicit implementation assignments
This commit is contained in:
@ -21,7 +21,10 @@
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
/*global define,Promise*/
|
/*global define,Promise*/
|
||||||
|
|
||||||
define(['legacyRegistry'], function (legacyRegistry) {
|
define([
|
||||||
|
'legacyRegistry',
|
||||||
|
'./src/BrowseController'
|
||||||
|
], function (legacyRegistry, BrowseController) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
legacyRegistry.register("platform/commonUI/browse", {
|
legacyRegistry.register("platform/commonUI/browse", {
|
||||||
@ -41,7 +44,7 @@ define(['legacyRegistry'], function (legacyRegistry) {
|
|||||||
"controllers": [
|
"controllers": [
|
||||||
{
|
{
|
||||||
"key": "BrowseController",
|
"key": "BrowseController",
|
||||||
"implementation": "BrowseController.js",
|
"implementation": BrowseController,
|
||||||
"depends": [
|
"depends": [
|
||||||
"$scope",
|
"$scope",
|
||||||
"$route",
|
"$route",
|
||||||
@ -55,7 +58,7 @@ define(['legacyRegistry'], function (legacyRegistry) {
|
|||||||
"key": "PaneController",
|
"key": "PaneController",
|
||||||
"implementation": "PaneController.js",
|
"implementation": "PaneController.js",
|
||||||
"priority": "preferred",
|
"priority": "preferred",
|
||||||
"depends": [ "$scope", "agentService","$window" ]
|
"depends": [ "$scope", "agentService", "$window" ]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": "BrowseObjectController",
|
"key": "BrowseObjectController",
|
||||||
|
@ -134,8 +134,28 @@ define(
|
|||||||
*/
|
*/
|
||||||
Extension.prototype.getImplementationPath = function () {
|
Extension.prototype.getImplementationPath = function () {
|
||||||
return this.definition.implementation ?
|
return this.definition.implementation ?
|
||||||
this.bundle.getSourcePath(this.definition.implementation) :
|
this.bundle.getSourcePath(this.definition.implementation) :
|
||||||
undefined;
|
undefined;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if an extension has an actual implementation value
|
||||||
|
* (and not just a path to an implementation) defined.
|
||||||
|
* @returns {function} the constructor for this extension instance
|
||||||
|
*/
|
||||||
|
Extension.prototype.getImplementationValue = function () {
|
||||||
|
return typeof this.definition.implementation === 'function' ?
|
||||||
|
this.definition.implementation :
|
||||||
|
undefined;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if an extension has an actual implementation value
|
||||||
|
* (and not just a path to an implementation) defined.
|
||||||
|
* @returns {boolean} true if a value is available
|
||||||
|
*/
|
||||||
|
Extension.prototype.hasImplementationValue = function () {
|
||||||
|
return typeof this.definition.implementation === 'function';
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -61,10 +61,10 @@ define(
|
|||||||
$log = this.$log;
|
$log = this.$log;
|
||||||
|
|
||||||
function loadImplementation(extension) {
|
function loadImplementation(extension) {
|
||||||
var implValue = extension.getImplementationPath(),
|
var implPath = extension.getImplementationPath(),
|
||||||
implPromise = (typeof implValue === 'string') ?
|
implPromise = extension.hasImplementationValue() ?
|
||||||
loader.load(implValue) :
|
Promise.resolve(extension.getImplementationValue()) :
|
||||||
Promise.resolve(implValue),
|
loader.load(implPath),
|
||||||
definition = extension.getDefinition();
|
definition = extension.getDefinition();
|
||||||
|
|
||||||
// Wrap a constructor function (to avoid modifying the original)
|
// Wrap a constructor function (to avoid modifying the original)
|
||||||
@ -122,7 +122,7 @@ define(
|
|||||||
// Log that loading has begun
|
// Log that loading has begun
|
||||||
$log.info([
|
$log.info([
|
||||||
"Loading implementation ",
|
"Loading implementation ",
|
||||||
implValue,
|
implPath,
|
||||||
" for extension ",
|
" for extension ",
|
||||||
extension.getLogName()
|
extension.getLogName()
|
||||||
].join(""));
|
].join(""));
|
||||||
|
Reference in New Issue
Block a user