[Framework] Initial skeletons for framework

Initial skeletons for framework classes, WTD-518.
This commit is contained in:
Victor Woeltjen 2014-10-31 13:15:05 -07:00
parent 83d06b6f8f
commit b55c6b8bce
3 changed files with 135 additions and 0 deletions

View 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;
}
);

View 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;
}
);

View 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;
}
);