-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: at now curried + some addition to documentation #677
Changes from all commits
bd7f3b5
e7072a2
a4c9b20
20cb91b
df402ab
516c61c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -286,7 +286,8 @@ at | |||
|
||||
.. code-block:: haskell | ||||
|
||||
at :: Time -> a -> Stream a | ||||
at :: (Time, a) -> Stream a | ||||
at :: Time -> Stream void | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unfortunately, the second signature is only valid for JavaScript. The TS types currently prevent calling Maybe we can keep only the first signature, and add a note for JavaScript users?
Suggested change
|
||||
|
||||
Create a :ref:`Stream` containing a single event at a specific time. :: | ||||
|
||||
|
@@ -318,6 +319,35 @@ Create a :ref:`Stream` that fails with the provided ``Error`` at time 0. This c | |||
|
||||
throwError(X): X | ||||
|
||||
.. _newStream: | ||||
|
||||
newStream | ||||
````````` | ||||
|
||||
.. code-block:: haskell | ||||
|
||||
newStream :: ((Sink a, Scheduler) -> Disposable) -> Stream a | ||||
|
||||
Create a :ref:`Stream` from a custom event producer (i.e. :ref:`run` method). | ||||
|
||||
.. code-block:: javascript | ||||
|
||||
import { currentTime as ct } from '@most/scheduler' | ||||
|
||||
// Number -> a -> Stream a | ||||
const valueAt = delay => value => newStream( | ||||
(sink, scheduler) => { | ||||
const publishVal = val => { | ||||
sink.event(ct(scheduler), val); | ||||
sink.end(ct(scheduler)); | ||||
}; | ||||
const timer = setTimeout(publishVal, delay, value); | ||||
return { dispose: () => { clearTimeout(timer); } }; | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||||
} | ||||
); | ||||
|
||||
valueAt(1000)(7): ---7| | ||||
|
||||
Extending | ||||
^^^^^^^^^ | ||||
|
||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Thanks