rxdart 0.2.0

rxdart #

Build Status Coverage Status Pub

This library uses the new Dart-Js interop available as of SDK 1.13.0

The RxJs library is wrapped and exposed via the Observable Dart class:

Example:

List<int> codes = <int>[
    38, // up
    38, // up
    40, // down
    40, // down
    37, // left
    39, // right
    37, // left
    39, // right
    66, // b
    65  // a
];
Element result = querySelector('#result');

new Rx.Observable<KeyboardEvent>.fromEvent(document.body, 'keyup')
    .map((KeyboardEvent e) => e.keyCode )           // get the key code
    .bufferWithCount(10, 1)                         // get the last 10 keys
    .filter((List<int> x) => _equal(x, codes))      // where we match
    .subscribe((_) => result.innerHtml = 'KONAMI!');

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  rxdart: ^0.2.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:rxdart/rxdart.dart';
  
Awaiting analysis to complete.