Skip to content

Instantly share code, notes, and snippets.

@njofce
Created February 16, 2020 12:14
Show Gist options
  • Select an option

  • Save njofce/deb90aad32bfd2ff4c87c1a88e63424d to your computer and use it in GitHub Desktop.

Select an option

Save njofce/deb90aad32bfd2ff4c87c1a88e63424d to your computer and use it in GitHub Desktop.
export class AppComponent {
name = 'Angular';
constructor(private _dataService: DataService){
this._dataService.getControllableDataStream().subscribe(val => {
console.log("received value: " + val);
})
}
toggleStream(toggle: number) {
this._dataService.toggleStream(toggle == 1 ? true : false);
setTimeout(() => {
console.log("sent value: 1");
this._dataService.publishToStream(1);
console.log("sent value: 2");
this._dataService.publishToStream(2);
}, 1000)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment