[API] Allow implementations to be passed directly

Allow implementations to be passed in as values,
instead of strings, facilitating the loading of
said implementations via RequireJS.
This commit is contained in:
Victor Woeltjen 2016-01-07 11:21:50 -08:00
parent 82990152d7
commit 4ed1836ae5

View File

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