Skip to content

Commit

Permalink
doc(framework): add yuidoc documentation.
Browse files Browse the repository at this point in the history
Bolster public-facing docunmentation.

Fixes aurelia#2 JSDoc documentation for public methods.
jwahyoung committed Jan 15, 2015
1 parent 8c0e3e4 commit d1de23f
Showing 3 changed files with 68 additions and 0 deletions.
46 changes: 46 additions & 0 deletions src/aurelia.js
Original file line number Diff line number Diff line change
@@ -31,6 +31,15 @@ function loadResources(container, resourcesToLoad, appResources){
return next();
}

/**
* The framework core that provides the main Aurelia object.
*
* @class Aurelia
* @constructor
* @param {Loader} loader The loader for this Aurelia instance to use. If a loader is not specified, Aurelia will use a defaultLoader.
* @param {Container} container The dependency injection container for this Aurelia instance to use. If a container is not specified, Aurelia will create an empty container.
* @param {ResourceRegistry} resources The resource registry for this Aurelia instance to use. If a resource registry is not specified, Aurelia will create an empty registry.
*/
export class Aurelia {
constructor(loader, container, resources){
this.loader = loader || Loader.createDefaultLoader();
@@ -44,16 +53,39 @@ export class Aurelia {
this.withInstance(ResourceRegistry, this.resources);
}

/**
* Adds an existing object to the framework's dependency injection container.
*
* @method withInstance
* @param {Class} type The object type of the dependency that the framework will inject.
* @param {Object} instance The existing instance of the dependency that the framework will inject.
* @return {Aurelia} Returns the current Aurelia instance.
*/
withInstance(type, instance){
this.container.registerInstance(type, instance);
return this;
}

/**
* Adds a singleton to the framework's dependency injection container.
*
* @method withSingleton
* @param {Class} type The object type of the dependency that the framework will inject.
* @param {Object} implementation The constructor function of the dependency that the framework will inject.
* @return {Aurelia} Returns the current Aurelia instance.
*/
withSingleton(type, implementation){
this.container.registerSingleton(type, implementation);
return this;
}

/**
* Adds a resource to be imported into the Aurelia framework.
*
* @method withResources
* @param {Object|Array} resources The constructor function(s) to use when the dependency needs to be instantiated.
* @return {Aurelia} Returns the current Aurelia instance.
*/
withResources(resources){
if (Array.isArray(resources)) {
this.resourcesToLoad.push(resources);
@@ -64,6 +96,12 @@ export class Aurelia {
return this;
}

/**
* Loads plugins, then resources, and then starts the Aurelia instance.
*
* @method start
* @return {Aurelia} Returns the started Aurelia instance.
*/
start(){
if(this.started){
return;
@@ -84,6 +122,14 @@ export class Aurelia {
});
}

/**
* Adds an object to the framework's dependency injection container.
*
* @method withSingleton
* @param {Object} root The root viewModel to load upon bootstrap.
* @param {string|Object} applicationHost The DOM object that Aurelia will attach to.
* @return {Aurelia} Returns the current Aurelia instance.
*/
setRoot(root, applicationHost){
var compositionEngine, instruction = {};

6 changes: 6 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/**
* Aurelia core framework module.
*
* @module framework
*/

export {Aurelia} from './aurelia';
export * from 'aurelia-dependency-injection';
export * from 'aurelia-binding';
16 changes: 16 additions & 0 deletions src/plugins.js
Original file line number Diff line number Diff line change
@@ -22,12 +22,28 @@ function loadPlugin(aurelia, loader, info){
});
}

/**
* A metadata annotation that describes the origin module of the function to which it's attached.
*
* @class Plugins
* @constructor
* @param {Aurelia} aurelia An instance of Aurelia.
*/
export class Plugins {
constructor(aurelia){
this.aurelia = aurelia;
this.info = [];
}

/**
* Installs a plugin before Aurelia starts.
*
* @method install
* @param {moduleId} moduleId The ID of the module to install.
* @param {config} config The configuration for the specified module.
* @return {Plugins} Returns the current Plugins instance.
* @for export
*/
install(moduleId, config){
this.info.push({moduleId:moduleId, config:config});
return this;

0 comments on commit d1de23f

Please sign in to comment.