Skip to content

Commit b12bb64

Browse files
committed
Merge pull request #54 from gaearon/dispatcher-api-update
hydrate() -> initialize(), dehydrate() => dispose()
2 parents d7a1c5b + 3402fad commit b12bb64

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

src/Dispatcher.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ export default class Dispatcher {
66
constructor(store) {
77
this.perform = this.perform.bind(this);
88
this.store = store;
9-
this.hydrate();
9+
this.initialize();
1010
}
1111

12-
hydrate({ atom, subscriptions = [] } = {}) {
12+
initialize({ atom, subscriptions = [] } = {}) {
1313
this.atom = atom;
1414
this.subscriptions = subscriptions;
1515
this.dispatch({});
1616
}
1717

18-
dehydrate() {
18+
dispose() {
1919
const { atom, subscriptions } = this;
2020
delete this.atom;
2121
this.subscriptions = [];

src/components/Provider.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ export default class Provider {
2525
}
2626

2727
componentWillReceiveProps(nextProps) {
28-
nextProps.dispatcher.hydrate(
29-
this.props.dispatcher.dehydrate()
28+
nextProps.dispatcher.initialize(
29+
this.props.dispatcher.dispose()
3030
);
3131
}
3232

src/createDispatcher.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ export default function createDispatcher(...args) {
66
return {
77
subscribe: ::dispatcher.subscribe,
88
perform: ::dispatcher.perform,
9-
hydrate: ::dispatcher.hydrate,
10-
dehydrate: ::dispatcher.dehydrate,
11-
getAtom: ::dispatcher.getAtom
9+
getAtom: ::dispatcher.getAtom,
10+
setAtom: ::dispatcher.setAtom,
11+
initialize: ::dispatcher.initialize,
12+
dispose: ::dispatcher.dispose
1213
};
1314
}

0 commit comments

Comments
 (0)