Skip to content

Remove scala-js-dom dependency #55

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 0 additions & 3 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,6 @@ lazy val webworker = project
.settings(
name := "scala-js-macrotask-executor-webworker",
scalaJSUseMainModuleInitializer := true,
libraryDependencies ++= Seq(
"org.scala-js" %%% "scalajs-dom" % "2.0.0",
),
(Test / test) := {
if (useJSEnv.value.isBrowser)
(Test / test).dependsOn(Compile / fastOptJS).value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

package org.scalajs.macrotaskexecutor

import org.scalajs.dom.DedicatedWorkerGlobalScope

import scala.scalajs.concurrent.QueueExecutionContext.timeouts
import scala.scalajs.js

Expand All @@ -32,7 +30,7 @@ object MacrotaskExecutorTestsRunner {
clamping <- tests.`sequence a series of 10,000 recursive executions without clamping`
fairness <- tests.`preserve fairness with setTimeout`
parallel <- tests.`execute a bunch of stuff in 'parallel' and ensure it all runs`
} yield DedicatedWorkerGlobalScope.self.postMessage(js.Dictionary(
} yield js.Dynamic.global.postMessage(js.Dictionary(
"clamping" -> clamping.isSuccess,
"fairness" -> fairness.isSuccess,
"parallel" -> parallel.isSuccess
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
package org.scalajs.macrotaskexecutor

import org.junit.Test
import org.scalajs.dom.MessageEvent
import org.scalajs.dom.Worker

import scala.concurrent.ExecutionContext
import scala.concurrent.Future
Expand All @@ -33,10 +31,11 @@ class WebWorkerMacrotaskTests {

implicit val ec: ExecutionContext = timeouts()

val worker = new Worker(s"file://${BuildInfo.workerDir}/main.js")
val worker =
js.Dynamic.newInstance(js.Dynamic.global.Worker)(s"file://${BuildInfo.workerDir}/main.js")

val testsResult = Promise[js.Dictionary[Boolean]]()
worker.onmessage = { (event: MessageEvent) =>
worker.onmessage = { (event: js.Dynamic) =>
testsResult.success(event.data.asInstanceOf[js.Dictionary[Boolean]])
}

Expand Down