[API] Fix explicit implementation assignments

This commit is contained in:
Victor Woeltjen
2016-01-07 11:31:22 -08:00
parent 4ed1836ae5
commit 5bbbdd4e50
3 changed files with 34 additions and 11 deletions

View File

@ -21,7 +21,10 @@
*****************************************************************************/
/*global define,Promise*/
define(['legacyRegistry'], function (legacyRegistry) {
define([
'legacyRegistry',
'./src/BrowseController'
], function (legacyRegistry, BrowseController) {
"use strict";
legacyRegistry.register("platform/commonUI/browse", {
@ -41,7 +44,7 @@ define(['legacyRegistry'], function (legacyRegistry) {
"controllers": [
{
"key": "BrowseController",
"implementation": "BrowseController.js",
"implementation": BrowseController,
"depends": [
"$scope",
"$route",
@ -55,7 +58,7 @@ define(['legacyRegistry'], function (legacyRegistry) {
"key": "PaneController",
"implementation": "PaneController.js",
"priority": "preferred",
"depends": [ "$scope", "agentService","$window" ]
"depends": [ "$scope", "agentService", "$window" ]
},
{
"key": "BrowseObjectController",

View File

@ -138,6 +138,26 @@ define(
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';
};
/**
* Get a log-friendly name for this extension; this will
* include both the key (machine-readable name for this

View File

@ -61,10 +61,10 @@ define(
$log = this.$log;
function loadImplementation(extension) {
var implValue = extension.getImplementationPath(),
implPromise = (typeof implValue === 'string') ?
loader.load(implValue) :
Promise.resolve(implValue),
var implPath = extension.getImplementationPath(),
implPromise = extension.hasImplementationValue() ?
Promise.resolve(extension.getImplementationValue()) :
loader.load(implPath),
definition = extension.getDefinition();
// Wrap a constructor function (to avoid modifying the original)
@ -122,7 +122,7 @@ define(
// Log that loading has begun
$log.info([
"Loading implementation ",
implValue,
implPath,
" for extension ",
extension.getLogName()
].join(""));