ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
functions.php
Go to the documentation of this file.
1<?php
2
4
12function setTimeout(callable $cb, $timeout) {
13
14 instance()->setTimeout($cb, $timeout);
15
16}
17
28function setInterval(callable $cb, $timeout) {
29
30 return instance()->setInterval($cb, $timeout);
31
32}
33
40function clearInterval($intervalId) {
41
42 instance()->clearInterval($intervalId);
43
44}
45
52function nextTick(callable $cb) {
53
54 instance()->nextTick($cb);
55
56}
57
58
72function addReadStream($stream, callable $cb) {
73
74 instance()->addReadStream($stream, $cb);
75
76}
77
91function addWriteStream($stream, callable $cb) {
92
93 instance()->addWriteStream($stream, $cb);
94
95}
96
104
105 instance()->removeReadStream($stream);
106
107}
108
116
117 instance()->removeWriteStream($stream);
118
119}
120
121
130function run() {
131
132 instance()->run();
133
134}
135
151function tick($block = false) {
152
153 return instance()->tick($block);
154
155}
156
162function stop() {
163
164 instance()->stop();
165
166}
167
173function instance(Loop $newLoop = null) {
174
175 static $loop;
176 if ($newLoop) {
177 $loop = $newLoop;
178 } elseif (!$loop) {
179 $loop = new Loop();
180 }
181 return $loop;
182
183}
An exception for terminatinating execution or to throw for unit testing.
A simple eventloop implementation.
Definition: Loop.php:18
$stream
PHP stream implementation.
addWriteStream($stream, callable $cb)
Adds a write stream.
Definition: functions.php:91
removeWriteStream($stream)
Stop watching a stream for writes.
Definition: functions.php:115
tick($block=false)
Executes all pending events.
Definition: functions.php:151
stop()
Stops a running eventloop.
Definition: functions.php:162
setInterval(callable $cb, $timeout)
Executes a function every x seconds.
Definition: functions.php:28
setTimeout(callable $cb, $timeout)
Executes a function after x seconds.
Definition: functions.php:12
run()
Runs the loop.
Definition: functions.php:130
removeReadStream($stream)
Stop watching a stream for reads.
Definition: functions.php:103
clearInterval($intervalId)
Stops a running internval.
Definition: functions.php:40
nextTick(callable $cb)
Runs a function immediately at the next iteration of the loop.
Definition: functions.php:52
instance(Loop $newLoop=null)
Retrieves or sets the global Loop object.
Definition: functions.php:173
addReadStream($stream, callable $cb)
Adds a read stream.
Definition: functions.php:72