You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Permission is hereby granted, free of charge, to any person obtaining a copy
6
-
of this software and associated documentation files (the "Software"), to deal
7
-
in the Software without restriction, including without limitation the rights
8
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
-
copies of the Software, and to permit persons to whom the Software is
10
-
furnished to do so, subject to the following conditions:
6
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
11
7
12
-
The above copyright notice and this permission notice shall be included in all
13
-
copies or substantial portions of the Software.
8
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
14
9
15
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
-
SOFTWARE.
10
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
An official subproject of [Cycle.js](http://cycle.js.org) built
4
-
on top [most.js](https://github.com/cujojs/most) instead of RxJS
5
-
for its Observable/Stream implementation, and using
6
-
[Snabbdom](https://github.com/paldepind/snabbdom) to interact
7
-
with the DOM.
8
-
9
3
[](https://gitter.im/cyclejs/core?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)[](https://travis-ci.org/motorcyclejs/core)
10
4
5
+
This is the core of Motorcycle.js creating your applicaton loop tied together with `most.js`.
6
+
It separates your application logic into a pure (as much as JavaScript can be) function, and your
7
+
side-effectful code into drivers.
8
+
11
9
## Install
12
10
```
13
-
$ npm install @motorcycle/core // you can but don't ;)
14
-
$ npm install @cycle/most-run
11
+
$ npm install @motorcycle/core
15
12
```
16
13
17
-
## Merging with Cycle.js
18
-
We are in the process of merging this project with [Cycle.js](https://github.com/cyclejs). But Why?
19
-
20
-
21
-
We get to merge two wonderful communities together and focus on solving problems rather than duplicating efforts.
22
-
Stream conversions are also now done in a mostly automatic way!
23
-
Want to use a driver written in xstream or Rx 5? No problem if the driver is written for Cycle.js Diversity. It will be entirely seamless for you :)
24
-
25
-
#### Libraries that will continue to be maintained for most.js *only*
26
-
27
-
##### **DOM Driver**
28
-
@motorcycle/dom will continue to be the speed king that it currently is. It is at 100% feature parity with the latest Cycle.js Diversity version of @cycle/dom as of v2.0.0. However, it will **not** do any stream conversion like @cycle/dom to maximize performance to its greatest potential. @motorcycle/html has be rolled into this library for ease of maintanence going forward as well. Now imported as
29
-
30
-
```js
31
-
import {makeHTMLDriver} from'@motorcycle/dom'
32
-
```
33
-
34
-
##### **HTTP Driver**
35
-
@motorcycle/http will soon be at feature parity with the newest version of @cycle/http and will be maintained to avoid the need to import xstream as a dependency.
36
-
37
-
##### **What about everything else that used to be here?**
38
-
-@motorcycle/core - Please use [@cycle/most-run](https://github.com/cyclejs/most-run)
39
-
-@motorcycle/history - Please use [@cycle/history](https://github.com/cyclejs/history), it is 100% stream library agnostic and will not add any unneeded dependencies.
40
-
-@motorcycle/router - Please use [cyclic-router](https://github.com/cyclejs-community/cyclic-router), it is also 100% stream agnostic and will not andd any unneeded dependencies.
41
-
-@motorcycle/local-storage - This was a poorly done library to begin with, and I don't wish for anyone to reach for it. There is the very great [@cycle/storage](https://github.com/cyclejs/storage) driver, which with v3 can do stream conversions when used with @cycle/most-run. However it is written in xstream, and will require the xstream library to also be imported. local-storage as driver is very easily implemented per individual needs, please stop by the [Cycle.js gitter](https://gitter.im/cyclejs/core) or open an issue to discuss [here](https://github.com/cyclejs-community/cyclejs-community/issues/new).
42
-
43
-
44
14
## Want to Contribute?
45
15
46
16
If you found an issue or want to contribute code, please read
@@ -52,25 +22,20 @@ duplication of effort and further the possibility of your work being accepted.
52
22
Afterwards, please refer to our [repository guidelines](REPOSITORIES.md).
53
23
54
24
## Useful Utilities
55
-
-[most-subject](https://github.com/TylorS/most-subject) - A subject
25
+
-[most-subject](https://github.com/mostjs-community/most-subject) - A subject
56
26
implementation for most.js
57
-
-[most-proxy](https://github.com/Tylors/most-proxy) - Declarative circular dependencies for most.js
27
+
-[most-proxy](https://github.com/mostjs-community/most-proxy) - Declarative circular dependencies for most.js
58
28
59
29
## API
60
30
61
31
### run(main, drivers)
62
32
63
33
###### Importing
64
34
```js
65
-
// Why are you still using @motorcycle/core
66
-
importMotorcyclefrom'@motorcycle/core'
35
+
import*asMotorcyclefrom'@motorcycle/core'
67
36
68
37
Motorcycle.run(main, drivers)
69
38
70
-
// What you should be doing
71
-
importCyclefrom'@cycle/most-run'
72
-
73
-
Cycle.run(main, drivers)
74
39
```
75
40
76
41
Takes a `main` function and circularly connects it to the given
@@ -90,10 +55,6 @@ and outputs a collection of sinks Observables/Streams.
90
55
**drivers** :: Object - an object where keys are driver names
91
56
and values are driver functions.
92
57
93
-
**{onError}** :: Object - an object which currently only accepts an `onError()`
94
-
function. The optional `onError()` function allows for defining a custom Function
95
-
to be called when an error occurs in a stream from your application.
96
-
97
58
###### Return:
98
59
99
60
(Object) an object containing *sources*, *sinks*, and *dispose()* that
@@ -105,8 +66,5 @@ can be used for debugging or testing.
105
66
106
67
*dispose :: Function* - A function that will dispose of streams from sinks and sources.
0 commit comments