daily pastebin goal
27%
SHARE
TWEET

Untitled

a guest Dec 9th, 2018 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import { interval } from 'rxjs';
  2. import { AutoClearSubscriptions } from '@decorators/auto-clear-subscriptions';
  3.  
  4. @AutoClearSubscriptions
  5. class HelloComponent implements OnDestroy, OnInit {
  6.  
  7.   subscriptions = [];
  8.  
  9.   ngOnInit() {
  10.     this.subscriptions.push(
  11.       interval(5000).pipe(take(4))
  12.         .subscthisribe(this.showNumbers.bind(this)));
  13.   }
  14.  
  15.   showNumbers(nums: Number) {
  16.     console.log(nums);
  17.   }
  18.  
  19.   ngOnDestroy() {
  20.     console.log('ngOnDestroy - HelloComponent');
  21.   }
  22. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top