mirror of
https://github.com/nasa/openmct.git
synced 2025-02-20 17:33:23 +00:00
[Framework] Initial skeletons for framework
Initial skeletons for framework classes, WTD-518.
This commit is contained in:
parent
83d06b6f8f
commit
b55c6b8bce
47
platform/framework/src/Bundle.js
Normal file
47
platform/framework/src/Bundle.js
Normal file
@ -0,0 +1,47 @@
|
||||
/*global define*/
|
||||
|
||||
define(
|
||||
[],
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
|
||||
/**
|
||||
* A bundle's plain JSON definition.
|
||||
*
|
||||
* @name BundleDefinition
|
||||
* @property {string} name the human-readable name of this bundle
|
||||
* @property {Object.<string,ExtensionDefinition[]>} [extensions={}]
|
||||
* all extensions exposed by this bundle
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Instantiate a new reference to a bundle, based on its human-readable
|
||||
* definition.
|
||||
*
|
||||
* @param {string} path the path to the directory containing
|
||||
* this bundle
|
||||
* @param {BundleDefinition} definition
|
||||
* @returns {{getDefinition: Function}}
|
||||
* @constructor
|
||||
*/
|
||||
function Bundle(path, definition) {
|
||||
|
||||
|
||||
return {
|
||||
/**
|
||||
*
|
||||
* @returns {BundleDefinition} the raw definition of this bundle
|
||||
*/
|
||||
getDefinition: function () {
|
||||
return definition;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
new Bundle().getDefinition().extensions['k'][0].
|
||||
|
||||
return Bundle;
|
||||
}
|
||||
);
|
23
platform/framework/src/BundleLoader.js
Normal file
23
platform/framework/src/BundleLoader.js
Normal file
@ -0,0 +1,23 @@
|
||||
/*global define*/
|
||||
|
||||
/**
|
||||
* Module defining BundleLoader.js. Created by vwoeltje on 10/31/14.
|
||||
*/
|
||||
define(
|
||||
[],
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
*
|
||||
* @constructor
|
||||
*/
|
||||
function BundleLoader() {
|
||||
return {
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
return BundleLoader;
|
||||
}
|
||||
);
|
65
platform/framework/src/Extension.js
Normal file
65
platform/framework/src/Extension.js
Normal file
@ -0,0 +1,65 @@
|
||||
/*global define*/
|
||||
|
||||
define(
|
||||
[],
|
||||
function () {
|
||||
/**
|
||||
* An extension's plain JSON definition.
|
||||
*
|
||||
* @name ExtensionDefinition
|
||||
* @property {string} [key] the machine-readable identifier for this
|
||||
* extension
|
||||
* @property {string} [implementation] the path to the AMD module
|
||||
* which implements this extension; this path is relative
|
||||
* to the containing bundle's source folder.
|
||||
* @property {string[]} [depends=[]] the dependencies needed by this
|
||||
* extension; these are strings as shall be passed to
|
||||
* Angular's dependency resolution mechanism.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Instantiate a new extension based on its definition. This serves
|
||||
* primarily as a wrapper around the extension's definition to expose
|
||||
* a useful interface.
|
||||
*
|
||||
* An extension
|
||||
*
|
||||
* @param {Bundle} bundle the bundle which exposed this extension
|
||||
* @param {string} category the type of extension being exposed
|
||||
* @param {ExtensionDefinition} definition the plain definition of
|
||||
* this extension
|
||||
* @constructor
|
||||
*/
|
||||
function Extension(bundle, category, definition) {
|
||||
|
||||
|
||||
return {
|
||||
/**
|
||||
* @memberof Extension#
|
||||
* @returns {Bundle}
|
||||
*/
|
||||
getBundle: function () {
|
||||
return bundle;
|
||||
},
|
||||
/**
|
||||
* @memberof Extension#
|
||||
* @returns {string}
|
||||
*/
|
||||
getCategory: function () {
|
||||
return category;
|
||||
},
|
||||
/**
|
||||
* @memberof Extension#
|
||||
* @returns {ExtensionDefinition}
|
||||
*/
|
||||
getDefinition: function () {
|
||||
return definition;
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
return Extension;
|
||||
|
||||
}
|
||||
);
|
Loading…
x
Reference in New Issue
Block a user