File tree Expand file tree Collapse file tree 3 files changed +4
-10
lines changed
main/scala/org/scalajs/macrotaskexecutor
test/scala/org/scalajs/macrotaskexecutor Expand file tree Collapse file tree 3 files changed +4
-10
lines changed Original file line number Diff line number Diff line change @@ -155,9 +155,6 @@ lazy val webworker = project
155155 .settings(
156156 name := " scala-js-macrotask-executor-webworker" ,
157157 scalaJSUseMainModuleInitializer := true ,
158- libraryDependencies ++= Seq (
159- " org.scala-js" %%% " scalajs-dom" % " 2.0.0" ,
160- ),
161158 (Test / test) := {
162159 if (useJSEnv.value.isBrowser)
163160 (Test / test).dependsOn(Compile / fastOptJS).value
Original file line number Diff line number Diff line change 1616
1717package org .scalajs .macrotaskexecutor
1818
19- import org .scalajs .dom .DedicatedWorkerGlobalScope
20-
2119import scala .scalajs .concurrent .QueueExecutionContext .timeouts
2220import scala .scalajs .js
2321
@@ -32,7 +30,7 @@ object MacrotaskExecutorTestsRunner {
3230 clamping <- tests.`sequence a series of 10,000 recursive executions without clamping`
3331 fairness <- tests.`preserve fairness with setTimeout`
3432 parallel <- tests.`execute a bunch of stuff in 'parallel' and ensure it all runs`
35- } yield DedicatedWorkerGlobalScope .self .postMessage(js.Dictionary (
33+ } yield js. Dynamic .global .postMessage(js.Dictionary (
3634 " clamping" -> clamping.isSuccess,
3735 " fairness" -> fairness.isSuccess,
3836 " parallel" -> parallel.isSuccess
Original file line number Diff line number Diff line change 1717package org .scalajs .macrotaskexecutor
1818
1919import org .junit .Test
20- import org .scalajs .dom .MessageEvent
21- import org .scalajs .dom .Worker
2220
2321import scala .concurrent .ExecutionContext
2422import scala .concurrent .Future
@@ -33,10 +31,11 @@ class WebWorkerMacrotaskTests {
3331
3432 implicit val ec : ExecutionContext = timeouts()
3533
36- val worker = new Worker (s " file:// ${BuildInfo .workerDir}/main.js " )
34+ val worker =
35+ js.Dynamic .newInstance(js.Dynamic .global.Worker )(s " file:// ${BuildInfo .workerDir}/main.js " )
3736
3837 val testsResult = Promise [js.Dictionary [Boolean ]]()
39- worker.onmessage = { (event : MessageEvent ) =>
38+ worker.onmessage = { (event : js. Dynamic ) =>
4039 testsResult.success(event.data.asInstanceOf [js.Dictionary [Boolean ]])
4140 }
4241
You can’t perform that action at this time.
0 commit comments