Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions api-reports/2_12.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25351,6 +25351,12 @@ WorkerNavigator[JT] def onLine: Boolean
WorkerNavigator[JT] def platform: String
WorkerNavigator[JT] def sendBeacon(url: String, data: BodyInit?): Boolean (@deprecated in 2.0.0)
WorkerNavigator[JT] def userAgent: String
WorkerOptions[JT] var credentials: js.UndefOr[RequestCredentials]
WorkerOptions[JT] var name: js.UndefOr[String]
WorkerOptions[JT] var `type`: js.UndefOr[WorkerType]
WorkerType[JT]
WorkerType[SO] val classic: WorkerType
WorkerType[SO] val module: WorkerType
WriteableState[JT]
WriteableState[SO] val closed: WriteableState
WriteableState[SO] val closing: WriteableState
Expand Down
6 changes: 6 additions & 0 deletions api-reports/2_13.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25351,6 +25351,12 @@ WorkerNavigator[JT] def onLine: Boolean
WorkerNavigator[JT] def platform: String
WorkerNavigator[JT] def sendBeacon(url: String, data: BodyInit?): Boolean (@deprecated in 2.0.0)
WorkerNavigator[JT] def userAgent: String
WorkerOptions[JT] var credentials: js.UndefOr[RequestCredentials]
WorkerOptions[JT] var name: js.UndefOr[String]
WorkerOptions[JT] var `type`: js.UndefOr[WorkerType]
WorkerType[JT]
WorkerType[SO] val classic: WorkerType
WorkerType[SO] val module: WorkerType
WriteableState[JT]
WriteableState[SO] val closed: WriteableState
WriteableState[SO] val closing: WriteableState
Expand Down
10 changes: 6 additions & 4 deletions dom/src/main/scala/org/scalajs/dom/SharedWorker.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package org.scalajs.dom

import scala.scalajs.js
import scala.scalajs.js.annotation._
import scala.scalajs.js.|

/** The SharedWorker interface represents a specific kind of worker that can be accessed from several browsing contexts,
* such as several windows, iframes or even workers. They implement an interface different than dedicated workers and
Expand All @@ -17,13 +18,14 @@ import scala.scalajs.js.annotation._
* {{{var myWorker = new SharedWorker("aURL", name);}}}
* @param stringUrl
* A DOMString representing the URL of the script the worker will execute. It must obey the same-origin policy.
* @param name
* An optional argument that specifies an existing SharedWorkerGlobalScope.name — if this is specified then that
* SharedWorkerGlobalScope will be used as the scope for this shared worker.
* @param options
* A DOMString specifying an identifying name for the SharedWorkerGlobalScope representing the scope of the worker,
* which is mainly useful for debugging purposes. Or, an object containing option properties that can set when
* creating the object instance.
*/
@js.native
@JSGlobal
class SharedWorker(stringUrl: String, name: js.UndefOr[String] = js.native) extends AbstractWorker {
class SharedWorker(scriptURL: String, options: js.UndefOr[String | WorkerOptions] = js.native) extends AbstractWorker {

/** The port property of the SharedWorker interface returns a [[MessagePort]] object used to communicate and control
* the shared worker.
Expand Down
7 changes: 6 additions & 1 deletion dom/src/main/scala/org/scalajs/dom/Worker.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,15 @@ import scala.scalajs.js.annotation._
* Of note is the fact that workers may in turn spawn new workers as long as those workers are hosted within the same
* origin as the parent page. In addition, workers may use XMLHttpRequest for network I/O, with the exception that the
* responseXML and channel attributes on XMLHttpRequest always return null.
*
* @param scriptURL
* A USVString representing the URL of the script the worker will execute. It must obey the same-origin policy.
* @param options
* An object containing option properties that can be set when creating the object instance.
*/
@js.native
@JSGlobal
class Worker(stringUrl: String) extends AbstractWorker {
class Worker(scriptURL: String, options: js.UndefOr[WorkerOptions] = js.native) extends AbstractWorker {

/** The Worker.onmessage property represents an EventHandler, that is a function to be called when the message event
* occurs. These events are of type MessageEvent and will be called when the worker calls its own postMessage()
Expand Down