Fri, 16 Jan 2015 18:13:44 +0100
Integrate suggestion from review to improve consistency with existing code.
1 /* Any copyright is dedicated to the Public Domain.
2 * http://creativecommons.org/publicdomain/zero/1.0/ */
4 function log(text) {
5 dump("WORKER " + text + "\n");
6 }
8 function send(message) {
9 self.postMessage(message);
10 }
12 function finish() {
13 send({kind: "finish"});
14 }
16 function ok(condition, description) {
17 send({kind: "ok", condition: !!condition, description: "" + description});
18 }
20 function is(a, b, description) {
21 let outcome = a == b; // Need to decide outcome here, as not everything can be serialized
22 send({kind: "is", outcome: outcome, description: "" + description, a: "" + a, b: "" + b});
23 }
25 function isnot(a, b, description) {
26 let outcome = a != b; // Need to decide outcome here, as not everything can be serialized
27 send({kind: "isnot", outcome: outcome, description: "" + description, a: "" + a, b: "" + b});
28 }
30 function info(description) {
31 send({kind: "info", description: "" + description});
32 }