Skip to content

Commit

Permalink
docs: overall themeListener documentation updated
Browse files Browse the repository at this point in the history
  • Loading branch information
iamstarkov committed Jun 15, 2017
1 parent 955d392 commit 9b62882
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,19 +245,15 @@ function CustomWithTheme(Component) {
super(props);
this.state = { theme: {} };
this.setTheme = theme => this.setState({ theme });

this.themeListenerInit = themeListener.init.bind(this);
this.themeListenerSubscribe = themeListener.subscribe.bind(this);
this.themeListenerUnsubscribe = themeListener.unsubscribe.bind(this);
}
componentWillMount() {
this.themeListenerInit(this.setTheme);
this.setTheme(themeListener.initial(this.context))
}
componentDidMount() {
this.themeListenerSubscribe(this.setTheme);
this.unsubscribe = themeListener.subscribe(this.context, this.setTheme);
}
componentWillUnmount() {
this.themeListenerUnsubscribe();
this.unsubscribe();
}
render() {
const { theme } = this.state;
Expand Down

0 comments on commit 9b62882

Please sign in to comment.