Skip to content

Commit

Permalink
0.3.0 - Support plugins with multiple scopes.
Browse files Browse the repository at this point in the history
  • Loading branch information
delucis committed Aug 11, 2017
1 parent 2f25977 commit 47db38d
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 22 deletions.
5 changes: 3 additions & 2 deletions docs/index.html
Expand Up @@ -49,7 +49,8 @@

<section class="readme">
<article><h1>@delucis/reading-data</h1><p><a href="https://travis-ci.org/delucis/reading-data"><img src="https://travis-ci.org/delucis/reading-data.svg?branch=master" alt="Build Status"></a>
<a href="https://coveralls.io/github/delucis/reading-data?branch=master"><img src="https://coveralls.io/repos/github/delucis/reading-data/badge.svg?branch=master" alt="Coverage Status"></a></p>
<a href="https://coveralls.io/github/delucis/reading-data?branch=master"><img src="https://coveralls.io/repos/github/delucis/reading-data/badge.svg?branch=master" alt="Coverage Status"></a>
<a href="https://www.npmjs.com/package/@delucis/reading-data"><img src="https://img.shields.io/npm/v/@delucis/reading-data.svg" alt="npm (scoped)"></a></p>
<p>Aggregate data from different sources.</p>
<h2>Installation</h2><pre class="prettyprint source lang-sh"><code>npm install --save @delucis/reading-data</code></pre><h2>Usage</h2><h3>Introduction</h3><p><code>@delucis/reading-data</code> provides an interface for gathering data from
third-party APIs such as <a href="https://www.instapaper.com/">Instapaper</a>.</p>
Expand Down Expand Up @@ -123,7 +124,7 @@ <h2>Installation</h2><pre class="prettyprint source lang-sh"><code>npm install -
<br class="clear">

<footer>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.3</a> on Tue Aug 08 2017 02:04:04 GMT+0200 (CEST) using the Minami theme.
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.3</a> on Fri Aug 11 2017 12:51:55 GMT+0200 (CEST) using the Minami theme.
</footer>

<script>prettyPrint();</script>
Expand Down
18 changes: 11 additions & 7 deletions docs/index.js.html
Expand Up @@ -130,12 +130,16 @@ <h1 class="page-title">index.js</h1>
await Promise.all(plugins.map(async plugin => {
if (plugin.hasOwnProperty(hook) &amp;&amp; typeof plugin[hook] === 'function') {
let pluginConfig = context.config.plugins[plugin.__id__]
let pluginContext = {
config: pluginConfig,
data: context.data[pluginConfig.scope]
}
let pluginData = await plugin[hook](pluginContext, context)
context.data[pluginContext.config.scope] = pluginData
let pluginScopes = Array.isArray(pluginConfig.scope) ? pluginConfig.scope : Array.of(pluginConfig.scope)
await Promise.all(pluginScopes.map(async scope => {
let pluginContext = {
config: pluginConfig,
data: context.data[scope],
scope: scope
}
let pluginData = await plugin[hook](pluginContext, context)
context.data[scope] = pluginData
}))
}
}))
return context.data
Expand Down Expand Up @@ -495,7 +499,7 @@ <h1 class="page-title">index.js</h1>
<br class="clear">

<footer>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.3</a> on Tue Aug 08 2017 02:04:04 GMT+0200 (CEST) using the Minami theme.
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.3</a> on Fri Aug 11 2017 12:51:55 GMT+0200 (CEST) using the Minami theme.
</footer>

<script>prettyPrint();</script>
Expand Down
22 changes: 11 additions & 11 deletions docs/module-reading-data.html
Expand Up @@ -245,7 +245,7 @@ <h5 class="subsection-title">Properties:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line140">line 140</a>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line144">line 144</a>
</li></ul></dd>


Expand Down Expand Up @@ -322,7 +322,7 @@ <h4 class="name" id="~data"><span class="type-signature">(inner) </span>data<spa

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line128">line 128</a>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line132">line 132</a>
</li></ul></dd>


Expand Down Expand Up @@ -399,7 +399,7 @@ <h4 class="name" id="~plugins"><span class="type-signature">(inner) </span>plugi

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line148">line 148</a>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line152">line 152</a>
</li></ul></dd>


Expand Down Expand Up @@ -487,7 +487,7 @@ <h4 class="name" id="~addHook"><span class="type-signature">(inner) </span>addHo

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line174">line 174</a>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line178">line 178</a>
</li></ul></dd>


Expand Down Expand Up @@ -752,7 +752,7 @@ <h4 class="name" id="~clean"><span class="type-signature">(inner) </span>clean<s

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line247">line 247</a>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line251">line 251</a>
</li></ul></dd>


Expand Down Expand Up @@ -953,7 +953,7 @@ <h4 class="name" id="~hooks"><span class="type-signature">(inner) </span>hooks<s

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line269">line 269</a>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line273">line 273</a>
</li></ul></dd>


Expand Down Expand Up @@ -1065,7 +1065,7 @@ <h4 class="name" id="~preloadData"><span class="type-signature">(inner) </span>p

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line392">line 392</a>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line396">line 396</a>
</li></ul></dd>


Expand Down Expand Up @@ -1249,7 +1249,7 @@ <h4 class="name" id="~run"><span class="type-signature">(inner) </span>run<span

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line436">line 436</a>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line440">line 440</a>
</li></ul></dd>


Expand Down Expand Up @@ -1393,7 +1393,7 @@ <h4 class="name" id="~uninstall"><span class="type-signature">(inner) </span>uni

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line353">line 353</a>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line357">line 357</a>
</li></ul></dd>


Expand Down Expand Up @@ -1598,7 +1598,7 @@ <h4 class="name" id="~use"><span class="type-signature">(inner) </span>use<span

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line300">line 300</a>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line304">line 304</a>
</li></ul></dd>


Expand Down Expand Up @@ -1791,7 +1791,7 @@ <h5>Example</h5>
<br class="clear">

<footer>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.3</a> on Tue Aug 08 2017 02:04:04 GMT+0200 (CEST) using the Minami theme.
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.3</a> on Fri Aug 11 2017 12:51:55 GMT+0200 (CEST) using the Minami theme.
</footer>

<script>prettyPrint();</script>
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "@delucis/reading-data",
"version": "0.2.0",
"version": "0.3.0",
"description": "Aggregate a user’s reading data from different sources.",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 47db38d

Please sign in to comment.