Skip to content

Commit

Permalink
updating docs and some examples
Browse files Browse the repository at this point in the history
  • Loading branch information
esatterwhite committed Jan 4, 2017
1 parent a72bec7 commit fa12e75
Show file tree
Hide file tree
Showing 30 changed files with 210 additions and 48 deletions.
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a>

on 2017-01-02T21:05:49-06:00
on 2017-01-03T20:10:11-06:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/index.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a>

on 2017-01-02T21:05:49-06:00
on 2017-01-03T20:10:11-06:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
5 changes: 2 additions & 3 deletions docs/lib_json.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,13 @@ <h1 class="page-title">Source: lib/json.js</h1>
* @typedef {Object} Result
* @property {?Error} [error=null] An error if json parsing faile
* @property {Object} value the result of Json parsing
* @return {TYPE} DESCRIPTION
**/

/**
* Wrpper around try/catch of JSON parsing
* @method module:skyring/lib/json
* @param {String} json A JSON string to parse
* @return {Result}
* @return {module:skyring/lib/json~Result}
**/
exports.parse = function parse(json) {
if (!json) return {error: null, value: {}}
Expand Down Expand Up @@ -147,7 +146,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a>

on 2017-01-02T21:05:49-06:00
on 2017-01-03T20:10:11-06:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
26 changes: 18 additions & 8 deletions docs/lib_nats.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ <h1 class="page-title">Source: lib/nats.js</h1>
* Small wrapper around nats for quickly connecting / disconnecting
* @module skyring/lib/nats
* @author Eric Satterwhite
* @since 1.0.0.0
* @since 1.0.0
* @requires url
* @requires nats
* @requires keef
Expand All @@ -102,28 +102,37 @@ <h1 class="page-title">Source: lib/nats.js</h1>
/**
* Creates a new nats client
* @method module:skyring/lib/nats#createClient
* @return {RedisClient} A nats client instance
* @param {Object} [options] nats client configuration
* @param {String} [options.hosts=localhost:4222] a comma separated list of addresses of nats hosts to connect to
* @return {NatsClient} A nats client instance
* @example
nats.createClient({
hosts:'nats-1.domain.com:4222,nats-2.domain.com:4223,localhost:4222'
})
**/
exports.createClient = createClient

/**
* Disconnects the current client from nats
* @method module:skyring/lib/nats#quit
**/
exports.quit = quit;
exports.disconnect = util.deprecate((cb) => {
quit(cb)
}, 'nats.disconnect: use nats.quit instead');
exports.quit = quit;

Object.defineProperty(exports, 'client', {
get: function() {
return client || createClient()
}
})

function createClient() {
const servers = Array.isArray(nats_hosts) ? nats_hosts : parse(nats_hosts);
debug('creating nats client', servers);
client = nats.connect({servers});
function createClient(options) {
const hosts = options.hosts || nats_hosts;
const servers = Array.isArray(hosts) ? hosts : parse(hosts);
const opts = Object.assign({}, options, {servers});
debug('creating nats client', opts);
client = nats.connect(opts);
client.on('error', (err) => {
console.error('nats error', err);
});
Expand Down Expand Up @@ -154,6 +163,7 @@ <h1 class="page-title">Source: lib/nats.js</h1>
client.close();
client.once('close', cb);
}

function parse(str) {
if (typeof str !== 'string') {
throw new TypeError('nats hosts must be a string');
Expand Down Expand Up @@ -214,7 +224,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a>

on 2017-01-02T21:05:49-06:00
on 2017-01-03T20:10:11-06:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
6 changes: 3 additions & 3 deletions docs/lib_server_index.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ <h1 class="page-title">Source: lib/server/index.js</h1>
/**
* Primary server instance for a skyring app.
* @module skyring/lib/server
* @author Eric Satterwhite
* @since 1.0.0
* @requires http
* @requires debug
* @requires skyring/lib/server/mock
Expand All @@ -98,6 +96,8 @@ <h1 class="page-title">Source: lib/server/index.js</h1>
* @constructor
* @extends http.Server
* @alias module:skyring/lib/server
* @author Eric Satterwhite
* @since 1.0.0
* @param {Object} [options]
* @param {module:skyring/lib/server/node} [options.node] A customer node instance
* @param {String} [optiopns.node.host] host name for the node to listen on - 127.0.0.1 must be used for localhost ( not 0.0.0.0 )
Expand Down Expand Up @@ -295,7 +295,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a>

on 2017-01-02T21:05:49-06:00
on 2017-01-03T20:10:11-06:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/lib_server_mock.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a>

on 2017-01-02T21:05:49-06:00
on 2017-01-03T20:10:11-06:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/lib_server_node.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a>

on 2017-01-02T21:05:49-06:00
on 2017-01-03T20:10:11-06:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/lib_server_router.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a>

on 2017-01-02T21:05:49-06:00
on 2017-01-03T20:10:11-06:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/lib_timer.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a>

on 2017-01-02T21:05:49-06:00
on 2017-01-03T20:10:11-06:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/lib_transports_callback.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a>

on 2017-01-02T21:05:49-06:00
on 2017-01-03T20:10:11-06:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/lib_transports_http.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a>

on 2017-01-02T21:05:49-06:00
on 2017-01-03T20:10:11-06:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/lib_transports_index.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a>

on 2017-01-02T21:05:49-06:00
on 2017-01-03T20:10:11-06:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/module-keef.html
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a>

on 2017-01-02T21:05:49-06:00
on 2017-01-03T20:10:11-06:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/module-skyring.html
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a>

on 2017-01-02T21:05:49-06:00
on 2017-01-03T20:10:11-06:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
4 changes: 2 additions & 2 deletions docs/module-skyring_lib_json.html
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ <h5>Returns:</h5>
</dt>
<dd>

<span class="param-type">Result</span>
<span class="param-type"><a href="module-skyring_lib_json.html#~Result">module:skyring/lib/json~Result</a></span>



Expand Down Expand Up @@ -501,7 +501,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a>

on 2017-01-02T21:05:49-06:00
on 2017-01-03T20:10:11-06:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
Loading

0 comments on commit fa12e75

Please sign in to comment.