blob: e3e59a21d7ea2a25f579354477ddd18f19521880 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
----
-- Stream of external side-effects.
--
-- Unlike other `Stream`s, this is not updated/set by an `Op` instace, but is
-- continuously polled for changes by the runtime and may mark itself as
-- *dirty* at any point in time. All runtime execution happens due to IOStream
-- updates, which ripple through the `Result` tree.
--
-- @classmod IOStream
import EventStream from require 'core.stream.event'
class IOStream extends EventStream
--- IOStream interface.
--
-- methods that have to be implemented by `IOStream` implementations.
-- @section interface
--- construct a new IOStream.
--
-- Must prepare the instance for `dirty` to be called.
-- The super-constructor should be called to set `Stream.type`.
--
-- @classmethod
-- @tparam string type the typename of this stream.
new: (type) => super type
--- create a mutable copy of this stream.
--
-- Used to wrap insulate eval-cycles from each other.
--
-- @treturn IOStream
fork: => @
--- poll for changes.
--
-- Called every frame by the main event loop to update internal state.
tick: =>
--- check whether this adapter requires processing.
--
-- Must return a boolean indicating whether `Op`s that refer to this instance
-- via `Input.hot` should be notified (via `Op:tick`). May be called multiple
-- times. May be called before `tick` on the first frame after construction.
--
-- If this is not overrided, the `EventStream` interface can be used, see
-- `EventStream.add`, `EventStream.unwrap`, and `EventStream.dirty`.
--
-- @function dirty
-- @treturn bool whether processing is required
__inherited: (cls) => cls.__base.__tostring = @__tostring
{
:IOStream
}
|