Skip to content
This repository was archived by the owner on Apr 20, 2018. It is now read-only.
This repository was archived by the owner on Apr 20, 2018. It is now read-only.

Compare core.async to RxJS #276

@mattpodwysocki

Description

@mattpodwysocki

How would you solve this issue with RxJS versus core.async?

My solution would be:

var magicSequence = 'ABBABA';

var keyups = Rx.Observable.fromEvent(document, 'keyup')
  .map(function (x) { return x.keyCode; })
  .bufferWithCount(6, 6)
  .take(1)
  .timeout(5000, Rx.Observable.just([]))
  .filter(function (xs) {
    return xs.map(function (x) { return String.fromCharCode(x); }).join('') === magicSequence;
  })
  .repeat()
  .subscribe(function (x) {
    console.log('Magic Keys!');
  });

Any thoughts @staltz, @headinthebox, @jhusain, @benjchristensen?

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions