Skip to content

Instantly share code, notes, and snippets.

@borisd
Last active May 10, 2016 15:32
Show Gist options
  • Save borisd/802117796c90d4a15431f734f2a7100c to your computer and use it in GitHub Desktop.
Save borisd/802117796c90d4a15431f734f2a7100c to your computer and use it in GitHub Desktop.
using.ts
export class Connect {
private _store;
public unsubscribe;
public state;
constructor(store) {
this._store = store;
this.state = store.getState();
}
ngOnInit():any {
this.unsubscribe = this._store.subscribe( () => this.state = this._store.getState());
}
ngOnDestroy():any {
this. unsubscribe()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment