Skip to content
This repository has been archived by the owner on Feb 25, 2019. It is now read-only.

Commit

Permalink
docs(plugin): rename app in code examples; correct method names
Browse files Browse the repository at this point in the history
  • Loading branch information
christiansmith committed Feb 12, 2016
1 parent fc669f8 commit 13c6ef8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
1 change: 1 addition & 0 deletions src/arch/Host.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class Host {
* application.
*
* @param {Object} options - Options object
* @returns {Host}
*/
static bootstrap (options) {
let host = new Host(options)
Expand Down
33 changes: 17 additions & 16 deletions src/arch/Plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class Plugin {
*
* @example <caption>Usage</caption>
*
* sunstone.plugin(<NAME>, <METADATA>)
* app.plugin(<NAME>, <METADATA>)
* .initializer(function (plugin) {
* plugin.require('express')
*
Expand Down Expand Up @@ -125,15 +125,16 @@ class Plugin {
* 'use strict'
*
* module.exports = function (sunstone) {
* sunstone.plugin('MyResource', {
* app.plugin('MyResource', {
* version: '0.0.1',
* dependencies: {
* 'Server': '0.0.1'
* }
* })
* .initializer(function (plugin) {
* .include('./other')
* .include('./yetanother')
* plugin
* .include('./other')
* .include('./yetanother')
* })
* }
*
Expand Down Expand Up @@ -316,7 +317,7 @@ class Plugin {
* @example <caption>Extending Data Schema</caption>
*
* // Given a plugin created as follows
* sunstone.plugin('Default API', <METADATA>)
* app.plugin('Default API', <METADATA>)
* .initializer(function (plugin) {
* .factory('User', function (Resource) {
* class User extends Resource {
Expand All @@ -332,7 +333,7 @@ class Plugin {
* })
* })
*
* sunstone.plugin('My Project', <METADATA>)
* app.plugin('My Project', <METADATA>)
* .initializer(function (plugin) {
* plugin.extension('UserExtension', function (User) {
* User.extendSchema({
Expand All @@ -343,14 +344,14 @@ class Plugin {
*
* @example <caption>Adding Event Handler</caption>
*
* sunstone.plugin(<NAME>, <METADATA>)
* app.plugin(<NAME>, <METADATA>)
* .initializer(function (plugin) {
* plugin.factory('emitter', function () {
* return new EventEmitter()
* })
* })
*
* sunstone.plugin('My Project', <METADATA>)
* app.plugin('My Project', <METADATA>)
* .initializer(function (plugin) {
* plugin.extension('CustomEventHandlers', function (emitter) {
* emitter.on('ready', function (event) {
Expand Down Expand Up @@ -384,7 +385,7 @@ class Plugin {
* like so:
*
* ```js
* sunstone.plugin('server', {
* app.plugin('server', {
* version: '0.0.0'
* })
* .initializer(function (plugin) {
Expand All @@ -405,7 +406,7 @@ class Plugin {
* This makes a new dependency registrar called 'router' that can be used as follows:
*
* ```js
* sunstone.plugin('other', {
* app.plugin('other', {
* version: '0.0.0'
* })
* .initializer(function (plugin) {
Expand All @@ -429,7 +430,7 @@ class Plugin {
* The dependency inject can then be queried by this new "type" value.
*
* ```js
* injector.find({ type: 'router' })
* injector.filter({ type: 'router' })
* ```
*
* @todo there should possibly be a way to create a starter method automatically for an assembler to save that boilerplate
Expand Down Expand Up @@ -457,8 +458,8 @@ class Plugin {
*
* @example <caption>Usage</caption>
*
* module.exports = function (sunstone) {
* sunstone.plugin('MyResource', {
* module.exports = function (app) {
* app.plugin('MyResource', {
* version: '0.0.1',
* dependencies: {
* 'Server': '0.0.1'
Expand Down Expand Up @@ -505,11 +506,11 @@ class Plugin {
*
* @example <caption>Usage</caption>
*
* sunstone.plugin(<NAME>, <METADATA>)
* app.plugin(<NAME>, <METADATA>)
* .initializer(function (plugin) {
* plugin.starter(function (injector, server) {
* injector
* .find({ plugin: this.name, type: 'router' })
* .filter({ plugin: this.name, type: 'router' })
* .values()
* .forEach(router => {
* router.mount(server)
Expand Down Expand Up @@ -553,7 +554,7 @@ class Plugin {
*
* @example <caption>Usage</caption>
*
* sunstone.plugin(<NAME>, <METADATA>)
* app.plugin(<NAME>, <METADATA>)
* .initializer(function (plugin) {
* plugin.stopper(function (injector, server) {
* // code to disable plugin
Expand Down

0 comments on commit 13c6ef8

Please sign in to comment.