Skip to content

Commit

Permalink
hydrate() -> initialize(), dehydrate() => dispose()
Browse files Browse the repository at this point in the history
  • Loading branch information
acdlite committed Jun 6, 2015
1 parent ff56611 commit 3402fad
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/Dispatcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ export default class Dispatcher {
constructor(store) {
this.perform = this.perform.bind(this);
this.store = store;
this.hydrate();
this.initialize();
}

hydrate({ atom, subscriptions = [] } = {}) {
initialize({ atom, subscriptions = [] } = {}) {
this.atom = atom;
this.subscriptions = subscriptions;
this.dispatch({});
}

dehydrate() {
dispose() {
const { atom, subscriptions } = this;
delete this.atom;
this.subscriptions = [];
Expand Down
4 changes: 2 additions & 2 deletions src/components/Provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ export default class Provider {
}

componentWillReceiveProps(nextProps) {
nextProps.dispatcher.hydrate(
this.props.dispatcher.dehydrate()
nextProps.dispatcher.initialize(
this.props.dispatcher.dispose()
);
}

Expand Down
7 changes: 4 additions & 3 deletions src/createDispatcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ export default function createDispatcher(...args) {
return {
subscribe: ::dispatcher.subscribe,
perform: ::dispatcher.perform,
hydrate: ::dispatcher.hydrate,
dehydrate: ::dispatcher.dehydrate,
getAtom: ::dispatcher.getAtom
getAtom: ::dispatcher.getAtom,
setAtom: ::dispatcher.setAtom,
initialize: ::dispatcher.initialize,
dispose: ::dispatcher.dispose
};
}

0 comments on commit 3402fad

Please sign in to comment.