From 3402fadbf544ce58d625b5e74d115a3e968d8cff Mon Sep 17 00:00:00 2001 From: Andrew Clark Date: Sat, 6 Jun 2015 13:48:39 -0700 Subject: [PATCH] hydrate() -> initialize(), dehydrate() => dispose() --- src/Dispatcher.js | 6 +++--- src/components/Provider.js | 4 ++-- src/createDispatcher.js | 7 ++++--- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/Dispatcher.js b/src/Dispatcher.js index 8cbeea48fb..7f230bad0f 100644 --- a/src/Dispatcher.js +++ b/src/Dispatcher.js @@ -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 = []; diff --git a/src/components/Provider.js b/src/components/Provider.js index 243b92faf6..06b6a07b25 100644 --- a/src/components/Provider.js +++ b/src/components/Provider.js @@ -25,8 +25,8 @@ export default class Provider { } componentWillReceiveProps(nextProps) { - nextProps.dispatcher.hydrate( - this.props.dispatcher.dehydrate() + nextProps.dispatcher.initialize( + this.props.dispatcher.dispose() ); } diff --git a/src/createDispatcher.js b/src/createDispatcher.js index bbeae6c866..f0af386a85 100644 --- a/src/createDispatcher.js +++ b/src/createDispatcher.js @@ -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 }; }