Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
<script src="https://unpkg.com/@reactivex/rxjs@5.0.3/dist/global/Rx.js"></script>
</body>
</html>
 
console.clear();
console.log('first():');
let subscription1 = Rx.Observable.interval(1000).first().subscribe();
console.log('closed before calling unsubscribe?: ' + subscription1.closed);
subscription1.unsubscribe();
console.log('closed after calling unsubscribe?: ' + subscription1.closed);
console.log('----------------');
console.log('take(1):');
let subscription2 = Rx.Observable.interval(1000).take(1).subscribe();
console.log('closed before calling unsubscribe?: ' + subscription2.closed);
subscription2.unsubscribe();
console.log('closed after calling unsubscribe?: ' + subscription2.closed);
Output 300px

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers