@cycle/run
Advanced tools
Comparing version 1.0.0-rc.9 to 1.0.0
@@ -0,1 +1,7 @@ | ||
<a name="1.0.0"></a> | ||
# 1.0.0 (2017-02-22) | ||
First stable version of this package. | ||
<a name="1.0.0-rc.9"></a> | ||
@@ -2,0 +8,0 @@ # 1.0.0-rc.9 (2017-02-08) |
{ | ||
"name": "@cycle/run", | ||
"version": "1.0.0-rc.9", | ||
"version": "1.0.0", | ||
"description": "The Cycle.js run() function to use with xstream", | ||
@@ -58,5 +58,5 @@ "license": "MIT", | ||
"dist": "npm run lib && npm run browserify && npm run uglify", | ||
"readme": "node ../.scripts/make-api-docs.js ${PWD##*/} && cat ./.scripts/template-readme.md ./generated-api.md > README.md && rm ./generated-api.md", | ||
"docs": "node ../.scripts/make-api-docs.js ${PWD##*/}", | ||
"preversion": "npm test", | ||
"version": "npm run dist && npm run readme && npm run changelog", | ||
"version": "npm run dist && npm run docs && npm run changelog", | ||
"postversion": "git add -A && git commit -m \"release(${PWD##*/}): v$(cat package.json | ../node_modules/.bin/jase version)\" && git push origin master && npm publish", | ||
@@ -63,0 +63,0 @@ "release-patch": "false", |
@@ -1,86 +0,1 @@ | ||
# Run() for xstream | ||
Cycle.js `run(main, drivers)` function for applications written with xstream. | ||
``` | ||
npm install @cycle/run xstream | ||
``` | ||
**Note: `xstream` package is required too.** | ||
## Basic usage | ||
```js | ||
import {run} from '@cycle/run' | ||
run(main, drivers) | ||
``` | ||
# API | ||
- [`setup`](#setup) | ||
- [`run`](#run) | ||
### <a id="setup"></a> `setup(main, drivers)` | ||
A function that prepares the Cycle application to be executed. Takes a `main` | ||
function and prepares to circularly connects it to the given collection of | ||
driver functions. As an output, `setup()` returns an object with three | ||
properties: `sources`, `sinks` and `run`. Only when `run()` is called will | ||
the application actually execute. Refer to the documentation of `run()` for | ||
more details. | ||
**Example:** | ||
```js | ||
import {setup} from '@cycle/run'; | ||
const {sources, sinks, run} = setup(main, drivers); | ||
// ... | ||
const dispose = run(); // Executes the application | ||
// ... | ||
dispose(); | ||
``` | ||
#### Arguments: | ||
- `main: Function` a function that takes `sources` as input and outputs `sinks`. | ||
- `drivers: Object` an object where keys are driver names and values are driver functions. | ||
#### Return: | ||
*(Object)* an object with three properties: `sources`, `sinks` and `run`. `sources` is the collection of driver sources, `sinks` is the | ||
collection of driver sinks, these can be used for debugging or testing. `run` | ||
is the function that once called will execute the application. | ||
- - - | ||
### <a id="run"></a> `run(main, drivers)` | ||
Takes a `main` function and circularly connects it to the given collection | ||
of driver functions. | ||
**Example:** | ||
```js | ||
import run from '@cycle/run'; | ||
const dispose = run(main, drivers); | ||
// ... | ||
dispose(); | ||
``` | ||
The `main` function expects a collection of "source" streams (returned from | ||
drivers) as input, and should return a collection of "sink" streams (to be | ||
given to drivers). A "collection of streams" is a JavaScript object where | ||
keys match the driver names registered by the `drivers` object, and values | ||
are the streams. Refer to the documentation of each driver to see more | ||
details on what types of sources it outputs and sinks it receives. | ||
#### Arguments: | ||
- `main: Function` a function that takes `sources` as input and outputs `sinks`. | ||
- `drivers: Object` an object where keys are driver names and values are driver functions. | ||
#### Return: | ||
*(Function)* a dispose function, used to terminate the execution of the Cycle.js program, cleaning up resources used. | ||
- - - | ||
[Documentation for Cycle Run on cycle.js.org](https://cycle.js.org/api/run.html) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1
53448
2