Last active
May 8, 2018 21:19
-
-
Save JamieDixon/fac2399daa35ad82731838af280b5d89 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Usage example of what I've built so far. | |
// My guess is that this isn't implemented anything like the real RxJS either because | |
// performance concerns would be different, their abstractions would be | |
// fuller and better considered, and unlike me, they know what they're doing. | |
// This has been a project for fun and learning and I feel like I've learned a heck of a lot. | |
// This code logs 5, 6 at an interval of 1000ms before completing. | |
takeWhile(v => v < 7, | |
take(5, | |
interval(1000, | |
from([5, 6, 7, 2, 8, 9, 10, 11, 12, 13]) | |
) | |
) | |
) | |
.subscribe( | |
x => console.log('Array value ', x), | |
e => console.log('error ', e), | |
() => console.log('Array complete') | |
); | |
// This code logs the `clientX` property of the mouse event as the cursor moves, 5 times before completing. | |
const mouseSubscription = take(5, fromEvent(document, 'mousemove')) | |
.map(e => e.clientX) | |
.subscribe( | |
x => console.log('mouse ', x), | |
e => console.log('error', e), | |
() => console.log('mouse complete') | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment