Skip to content
This repository has been archived by the owner on Oct 26, 2021. It is now read-only.

Commit

Permalink
Added examples: sum, any, delayWithSelector
Browse files Browse the repository at this point in the history
  • Loading branch information
Andre Medeiros committed Aug 21, 2014
1 parent 0268b7d commit 9193d05
Show file tree
Hide file tree
Showing 5 changed files with 17,128 additions and 18 deletions.
3 changes: 2 additions & 1 deletion TODO
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ DONE Remove the no-longer-needed loading indicator
>>> v0.3.0 ## RC
>>> v1.0.0

TODO More trivial examples
DONE Added examples: sum, any, delayWithSelector
TODO Add more examples
TODO Render each stream with a different regular polygon
TODO Render also the stream completion time marker
>>> v1.1.0
Expand Down
17,105 changes: 17,100 additions & 5 deletions dist/js/app.js

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions src/models/boolean-examples.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ module.exports = {
"apply": (inputs) -> inputs[0].all((x) -> x.content < 10)
}

"any": {
"label": "any(x => x > 10)"
"inputs": [
[{t:5, d:2}, {t:15, d:30}, {t:25, d:22}, {t:35, d:5}, {t:45, d:60}, {t:55, d:1}]
]
"apply": (inputs) -> inputs[0].any((x) -> x.content > 10)
}

"contains": {
"label": "contains(22)"
"inputs": [
Expand Down
8 changes: 8 additions & 0 deletions src/models/math-examples.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,13 @@ module.exports = {
return 0
)
}

"sum": {
"label": "sum"
"inputs": [
[{t:5, d:1}, {t:15, d:2}, {t:25, d:3}, {t:35, d:4}, {t:65, d:5}]
]
"apply": (inputs) -> inputs[0].sum((x) -> x.content)
}
}

22 changes: 10 additions & 12 deletions src/models/transform-examples.coffee
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
Rx = require 'rx'

module.exports = {
# "concatMap": {
# "comingsoon": true
# }

"delay": {
"label": "delay"
"inputs": [
[{t:0, d:1}, {t:10, d:2}]
[{t:0, d:1}, {t:10, d:2}, {t:20, d:1}]
]
"apply": (inputs, scheduler) -> inputs[0].delay(20, scheduler)
}

# "flatMap": {
# "comingsoon": true
# }

# "flatMapLatest": {
# "comingsoon": true
# }
"delayWithSelector": {
"label": "delayWithSelector(x => Rx.Observable.timer(20 * x))"
"inputs": [
[{t:0, d:1}, {t:10, d:2}, {t:20, d:1}]
]
"apply": (inputs, scheduler) -> inputs[0].delayWithSelector((x) ->
return Rx.Observable.timer(Number(x.content) * 20, 1000, scheduler)
)
}

"map": {
"label": "map(x => 10 * x)"
Expand Down

0 comments on commit 9193d05

Please sign in to comment.