-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(): rewrite to boost performance
- Loading branch information
Showing
38 changed files
with
2,573 additions
and
858 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
{ | ||
"presets": [ | ||
"es2015" | ||
], | ||
"plugins": [ | ||
"syntax-flow", | ||
"transform-flow-strip-types" | ||
] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,4 @@ | ||
{ | ||
"parser": "babel-eslint", | ||
"extends": "eslint-config-cycle", | ||
"env": { | ||
"browser": true, | ||
"node": true | ||
}, | ||
"rules": { | ||
"no-class/no-class": 0, | ||
"quotes": 0 | ||
} | ||
"extends": "@most/eslint-config-most", | ||
"parser": "babel-eslint" | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[ignore] | ||
|
||
[include] | ||
|
||
[libs] | ||
|
||
[options] | ||
suppress_comment= \\(.\\|\n\\)*\\flow-ignore-next-line |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
language: node_js | ||
sudo: true | ||
node_js: | ||
- "6" | ||
- "5" | ||
- "4" | ||
env: | ||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,80 +1,7 @@ | ||
# Most Subject [![Build Status](https://travis-ci.org/TylorS/most-subject.svg?branch=master)](https://travis-ci.org/TylorS/most-subject) [![npm version](https://badge.fury.io/js/most-subject.svg)](https://badge.fury.io/js/most-subject) | ||
|
||
Subject and Subject-like interface to Most.js | ||
Subject interface for [most](https://github.com/cujojs/most) | ||
|
||
# API | ||
## API Documentation | ||
|
||
## holdSubject(bufferSize = 1[, initialValue]) | ||
|
||
[src/index.js:25-31](https://github.com/tylors/most-subject/tree/master/src/index.js#L25-L31 "Source code on GitHub") | ||
|
||
Creates a subject that replays past events that a new observer may have missed. | ||
|
||
**Parameters** | ||
|
||
- `bufferSize` **integer** [= 1] - how many values to keep buffered. | ||
Must be an integer 1 or greater. | ||
- `initialValue` **any** an initialValue to start with | ||
|
||
**Examples** | ||
|
||
```javascript | ||
import {holdSubject} from 'most-subject' | ||
|
||
// will keep 4 items buffered with an initialValue of 1 | ||
const {observer, stream} = holdSubject(4, 1) | ||
|
||
observer.next(2) | ||
observer.next(3) | ||
observer.next(4) | ||
|
||
stream.observe(x => console.log(x)) // 1 , 2 , 3, 4 , 5 | ||
|
||
observer.next(5) | ||
observer.complete() | ||
``` | ||
|
||
Returns [**Subject**](#subject-1) | ||
|
||
## subject() | ||
|
||
[src/index.js:21-23](https://github.com/tylors/most-subject/tree/master/src/index.js#L21-L23 "Source code on GitHub") | ||
|
||
Creates a basic Subject | ||
|
||
**Examples** | ||
|
||
```javascript | ||
import {subject} from 'most-subject' | ||
|
||
const {observer, stream} = subject() | ||
|
||
stream.observe(x => console.log(x)) // 1 , 2 , 3 | ||
|
||
observer.next(1) | ||
observer.next(2) | ||
observer.next(3) | ||
observer.complete() | ||
``` | ||
|
||
Returns [**Subject**](#subject-1) | ||
|
||
## Subject | ||
|
||
A Subject is simply an object with the following properties | ||
|
||
**Properties** | ||
|
||
- `observer` [**Observer**](#observer) | ||
- `stream` **most.Stream** A most.js Stream instance | ||
|
||
## Observer | ||
|
||
An Observer | ||
|
||
**Properties** | ||
|
||
- `next` **Function<any>** pushes a new value to the underlying Stream | ||
- `error` **Function<Error>** pushes a new Error to and ends | ||
the underlying Stream | ||
- `complete` **Function<Any>** ends the underlying Stream | ||
To find the API documentation follow [this link](https://tylors.github.io/most-subject/docs)! |
Oops, something went wrong.