Skip to content
This repository has been archived by the owner on Nov 4, 2022. It is now read-only.

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
pinicarus committed Nov 16, 2016
1 parent 654a43b commit ce9202d
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
40 changes: 40 additions & 0 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ Children classes must re-implement the `getValue&#39; method.</p>
</dd>
</dl>

# Typedefs

<dl>
<dt><a href="#Iterable">Iterable</a> : <code>Object</code></dt>
<dd><p>An iterable object</p>
</dd>
</dl>

<a name="Container"></a>

# Container
Expand All @@ -29,6 +37,8 @@ function or class.
* [.registerValue(name, value)](#Container+registerValue)
* [.registerFactory([name], functor, [policy])](#Container+registerFactory)
* [.inject(functor, [values])](#Container+inject) ⇒ <code>function</code>
* [.getOwnEntries()](#Container+getOwnEntries) ⇒ <code>[Iterable](#Iterable)</code>
* [.getEntries()](#Container+getEntries) ⇒ <code>[Iterable](#Iterable)</code>

<a name="new_Container_new"></a>

Expand Down Expand Up @@ -90,6 +100,24 @@ Inject a functor with registered values.
| functor | <code>function</code> | The functor to inject. |
| [values] | <code>Object.&lt;String, \*&gt;</code> | Extra injectable dependencies. |

<a name="Container+getOwnEntries"></a>

## container.getOwnEntries() ⇒ <code>[Iterable](#Iterable)</code>
Returns an iterable of [key, value] entries registered explicitely on the
container.

**Kind**: instance method of <code>[Container](#Container)</code>
**Returns**: <code>[Iterable](#Iterable)</code> - An iterable object over the entries of values
explicitely registered on the container.
<a name="Container+getEntries"></a>

## container.getEntries() ⇒ <code>[Iterable](#Iterable)</code>
Returns an iterable of [key, value] entries registered explicitely on the
container.

**Kind**: instance method of <code>[Container](#Container)</code>
**Returns**: <code>[Iterable](#Iterable)</code> - An iterable object over the entries of values
explicitely registered on the container.
<a name="Policy"></a>

# Policy
Expand All @@ -113,3 +141,15 @@ Returns a (possibly cached) value from the factory.
| context | <code>Context</code> | The injection context. |
| factory | <code>function</code> | The injected factory. |

<a name="Iterable"></a>

# Iterable : <code>Object</code>
An iterable object

**Kind**: global typedef
**Properties**

| Name | Type | Description |
| --- | --- | --- |
| @@iterator | <code>function</code> | The function returning an iterator over the iterable. |

19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,3 +184,22 @@ container.registerFactory("name", functor);

Functors injected at the container level can have default values for their
dependencies as well.

## Iterables

You can iterate over the values registered either on a single container:

```javascript
for(entry of container.getOwnEntries()) {
}
```

or on a container and all of its parentship hierarchy:

```javascript
for(entry of container.getEntries()) {
}
```

Entries are arrays with two values: the first element is the name under which the
value was registered and the second element is the value registered.

0 comments on commit ce9202d

Please sign in to comment.