Mercurial > irccd
annotate tests/data/timer.js @ 1123:6457999bfb7a
lib: irc_bot_post use a linked list instead
Using a pipe isn't a good idea since it's a byte stream in which every
invocation can arrive partially.
The additional threads now interrupts poll(2) using SIGUSR1.
author | David Demelier <markand@malikania.fr> |
---|---|
date | Sun, 28 Nov 2021 11:19:18 +0100 |
parents | 371e1cc2c697 |
children |
rev | line source |
---|---|
963
371e1cc2c697
tests: add 80% of the Javascript API
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
1 count = 0; |
371e1cc2c697
tests: add 80% of the Javascript API
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
2 |
371e1cc2c697
tests: add 80% of the Javascript API
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
3 function onLoad() |
371e1cc2c697
tests: add 80% of the Javascript API
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
4 { |
371e1cc2c697
tests: add 80% of the Javascript API
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
5 if (typeof (type) === "undefined") |
371e1cc2c697
tests: add 80% of the Javascript API
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
6 throw Error("global timer type not defined"); |
371e1cc2c697
tests: add 80% of the Javascript API
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
7 |
371e1cc2c697
tests: add 80% of the Javascript API
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
8 t = new Irccd.Timer(type, 50, function () { |
371e1cc2c697
tests: add 80% of the Javascript API
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
9 count += 1; |
371e1cc2c697
tests: add 80% of the Javascript API
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
10 }); |
371e1cc2c697
tests: add 80% of the Javascript API
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
11 |
371e1cc2c697
tests: add 80% of the Javascript API
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
12 t.start(); |
371e1cc2c697
tests: add 80% of the Javascript API
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
13 } |