Created
August 26, 2015 05:49
-
-
Save CharlieHess/b792e75789b2d6c40bb2 to your computer and use it in GitHub Desktop.
New Rx Hot Shit
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
let timeExpired = rx.Observable.timer(0, 1000, scheduler) | |
.take(timeout + 1) | |
.publishLast(); | |
let newPlayers = messages.where(e => e.text && e.text.toLowerCase().match(/\byes\b/)) | |
.map(e => e.user) | |
.distinct() | |
.take(maxPlayers) | |
.publish(); | |
newPlayers.connect(); | |
timeExpired.connect(); | |
// Once our timer has expired, we're done accepting new players. | |
return newPlayers.takeUntil(timeExpired); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment