1 | # <a href="http://kefirjs.github.io/kefir/"><img src="http://kefirjs.github.io/kefir/Kefir-with-bg.svg" width="60" height="60"></a> Kefir
|
2 |
|
3 |
|
4 |
|
5 | Kefir — is an Reactive Programming library for JavaScript
|
6 | inspired by [Bacon.js](https://github.com/baconjs/bacon.js)
|
7 | and [RxJS](https://github.com/Reactive-Extensions/RxJS)
|
8 | with focus on high performance and low memory usage.
|
9 |
|
10 | For docs visit [kefirjs.github.io/kefir](http://kefirjs.github.io/kefir).
|
11 | See also [Deprecated API docs](https://github.com/kefirjs/kefir/blob/master/deprecated-api-docs.md).
|
12 |
|
13 |
|
14 |
|
15 | [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/kefirjs/kefir/blob/master/LICENSE.txt)
|
16 | [![npm version](https://img.shields.io/npm/v/kefir.svg?style=flat)](https://www.npmjs.com/package/kefir)
|
17 | [![Build Status](https://travis-ci.org/kefirjs/kefir.svg?branch=master)](https://travis-ci.org/kefirjs/kefir)
|
18 | [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/pozadi/kefir?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
19 |
|
20 |
|
21 |
|
22 | # Installation
|
23 |
|
24 | Kefir available as NPM and Bower packages, as well as simple files download.
|
25 |
|
26 | ### NPM
|
27 | ```sh
|
28 | npm install kefir
|
29 | ```
|
30 |
|
31 | ### Bower
|
32 | ```sh
|
33 | bower install kefir
|
34 | ```
|
35 |
|
36 | ### Download
|
37 |
|
38 | See [downloads](https://kefirjs.github.io/kefir/#downloads) section in the docs.
|
39 |
|
40 | Also available on [jsDelivr](http://www.jsdelivr.com/#!kefir).
|
41 |
|
42 | # Browsers support
|
43 |
|
44 | We don't support IE8 and below, aside from that Kefir should work in any browser.
|
45 |
|
46 |
|
47 | ## [Flow](https://flowtype.org/)
|
48 |
|
49 | The NPM package ships with Flow definitions. So you can do something like this if you use Flow:
|
50 |
|
51 | ```js
|
52 | // @flow
|
53 |
|
54 | import Kefir from 'kefir'
|
55 |
|
56 | function foo(numberStream: Kefir.Observable<number>) {
|
57 | numberStream.onValue(x => {
|
58 | // Flow knows x is a number here
|
59 | });
|
60 | }
|
61 |
|
62 | const s = Kefir.constant(5);
|
63 | // Flow can automatically infer the type of values in the stream and determine
|
64 | // that `s` is of type Kefir.Observable<number> here.
|
65 | foo(s);
|
66 | ```
|
67 |
|
68 | # Development
|
69 |
|
70 | ```sh
|
71 | npm run prettify # makes source code pretty (you must run it before a PR could be merged)
|
72 | npm run build-js # builds js bundlers
|
73 | npm run test # runs all the checks
|
74 | npm run test-only # runs only unit tests without other checks
|
75 | npm run test-debug # runs tests with a chrome inspector connected to the node process
|
76 | npm run build-docs # builds the documentation html file
|
77 | ```
|