Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependencies and documentation #87

Merged
merged 3 commits into from
Dec 18, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ In summary, the API looks like this:

```js
var myComponent = d3.component("div", "some-class")
.create((selection, d) => { ... }) // Invoked for entering component instances.
.render((selection, d) => { ... }) // Invoked for entering AND updating component instances.
.destroy((selection, d) => { ... }); // Invoked for exiting instances, may return a transition.
.create((selection, d, i) => { ... }) // Invoked for entering component instances.
.render((selection, d, i) => { ... }) // Invoked for entering AND updating component instances.
.destroy((selection, d, i) => { ... }); // Invoked for exiting instances, may return a transition.

// To invoke the component,
d3.select("body") // create a selection with a single element,
Expand All @@ -142,17 +142,17 @@ Creates a new component generator that manages and renders into DOM elements of

The optional parameter *className* determines the value of the `class` attribute on the DOM elements managed.

<a href="#component_create" name="component_create" >#</a> <i>component</i>.<b>create</b>(<i>function</i>)
<a href="#component_create" name="component_create" >#</a> <i>component</i>.<b>create</b>(<i>function(selection, d, i)</i>)

Sets the create *function* of this component generator, which will be invoked whenever a new component instance is created, being passed a *selection* containing the current DOM element and the current datum (*d*).
Sets the create *function* of this component generator, which will be invoked whenever a new component instance is created, being passed a *selection* containing the current DOM element, the current datum (*d*), and the index of the current datum (*i*).

<a href="#component_render" name="component_render" >#</a> <i>component</i>.<b>render</b>(<i>function</i>)
<a href="#component_render" name="component_render" >#</a> <i>component</i>.<b>render</b>(<i>function(selection, d, i)</i>)

Sets the render *function* of this component generator. This *function* will be invoked for each component instance during rendering, being passed a *selection* containing the current DOM element and the current datum (*d*).
Sets the render *function* of this component generator. This *function* will be invoked for each component instance during rendering, being passed a *selection* containing the current DOM element, the current datum (*d*), and the index of the current datum (*i*).

<a href="#component_destroy" name="component_destroy" >#</a> <i>component</i>.<b>destroy</b>(<i>function</i>)
<a href="#component_destroy" name="component_destroy" >#</a> <i>component</i>.<b>destroy</b>(<i>function(selection, d, i)</i>)

Sets the destroy *function* of this component generator, which will be invoked whenever a component instance is destroyed, being passed a *selection* containing the current DOM element and the current datum (*d*).
Sets the destroy *function* of this component generator, which will be invoked whenever a component instance is destroyed, being passed a *selection* containing the current DOM element, the current datum (*d*), and the index of the current datum (*i*).

When a component instance gets destroyed, the destroy *function* of all its children is also invoked (recursively), so you can be sure that this *function* will be invoked before the compoent instance is removed from the DOM.

Expand Down
Loading