Skip to content

Commit 0363fb4

Browse files
committed
1 parent 25dfe97 commit 0363fb4

File tree

1 file changed

+25
-5
lines changed

1 file changed

+25
-5
lines changed

src/main/scala/org/scalajs/dom/raw/WebWorkers.scala

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,34 @@ class Worker(stringUrl: String) extends AbstractWorker {
4848
var onmessage: js.Function1[js.Any, _] = js.native
4949

5050
/**
51-
* The Worker.postMessage() method sends a message to the worker's inner scope.
52-
* This accepts a single parameter, which is the data to send to the worker.
53-
* The data may be any value or JavaScript object handled by the structured
54-
* clone algorithm, which includes cyclical references.
51+
* The postMessage() method of the Worker interface sends a message to the
52+
* worker's inner scope. This accepts a single parameter, which is the data to
53+
* send to the worker. The data may be any value or JavaScript object handled
54+
* by the structured clone algorithm, which includes cyclical references.
55+
*
56+
* The Worker can send back information to the thread that spawned it using
57+
* the DedicatedWorkerGlobalScope.postMessage method.
5558
*
5659
* MDN
60+
*
61+
* @param aMessage The object to deliver to the worker; this will be in the
62+
* data field in the event delivered to the
63+
* DedicatedWorkerGlobalScope.onmessage handler. This may be
64+
* any value or JavaScript object handled by the structured
65+
* clone algorithm, which includes cyclical references.
66+
*
67+
* @param transferList An optional array of Transferable objects to transfer
68+
* ownership of. If the ownership of an object is
69+
* transferred, it becomes unusable (neutered) in the
70+
* context it was sent from and it becomes available only
71+
* to the main thread it was sent to.
72+
*
73+
* Only MessagePort and ArrayBuffer objects can be
74+
* transferred. null is not an acceptable value for the
75+
* transferList.
5776
*/
58-
def postMessage(message: js.Any, ports: js.Any = js.native): Unit = js.native
77+
def postMessage(aMessage: js.Any,
78+
transferList: js.UndefOr[js.Array[Transferable]] = js.native): Unit = js.native
5979

6080
/**
6181
* The Worker.terminate() method immediately terminates the Worker. This does

0 commit comments

Comments
 (0)