File tree 3 files changed +4
-10
lines changed
main/scala/org/scalajs/macrotaskexecutor
test/scala/org/scalajs/macrotaskexecutor
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
155
155
.settings(
156
156
name := " scala-js-macrotask-executor-webworker" ,
157
157
scalaJSUseMainModuleInitializer := true ,
158
- libraryDependencies ++= Seq (
159
- " org.scala-js" %%% " scalajs-dom" % " 2.0.0" ,
160
- ),
161
158
(Test / test) := {
162
159
if (useJSEnv.value.isBrowser)
163
160
(Test / test).dependsOn(Compile / fastOptJS).value
Original file line number Diff line number Diff line change 16
16
17
17
package org .scalajs .macrotaskexecutor
18
18
19
- import org .scalajs .dom .DedicatedWorkerGlobalScope
20
-
21
19
import scala .scalajs .concurrent .QueueExecutionContext .timeouts
22
20
import scala .scalajs .js
23
21
@@ -32,7 +30,7 @@ object MacrotaskExecutorTestsRunner {
32
30
clamping <- tests.`sequence a series of 10,000 recursive executions without clamping`
33
31
fairness <- tests.`preserve fairness with setTimeout`
34
32
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 (
36
34
" clamping" -> clamping.isSuccess,
37
35
" fairness" -> fairness.isSuccess,
38
36
" parallel" -> parallel.isSuccess
Original file line number Diff line number Diff line change 17
17
package org .scalajs .macrotaskexecutor
18
18
19
19
import org .junit .Test
20
- import org .scalajs .dom .MessageEvent
21
- import org .scalajs .dom .Worker
22
20
23
21
import scala .concurrent .ExecutionContext
24
22
import scala .concurrent .Future
@@ -33,10 +31,11 @@ class WebWorkerMacrotaskTests {
33
31
34
32
implicit val ec : ExecutionContext = timeouts()
35
33
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 " )
37
36
38
37
val testsResult = Promise [js.Dictionary [Boolean ]]()
39
- worker.onmessage = { (event : MessageEvent ) =>
38
+ worker.onmessage = { (event : js. Dynamic ) =>
40
39
testsResult.success(event.data.asInstanceOf [js.Dictionary [Boolean ]])
41
40
}
42
41
You can’t perform that action at this time.
0 commit comments