Skip to content

Commit

Permalink
Fix scala.js deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Mingun committed Nov 26, 2020
1 parent af69228 commit d10b795
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
8 changes: 4 additions & 4 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -197,13 +197,13 @@ lazy val buildNpmJsFileTask = Def.task {
val compiledFileContents = IO.read(compiledFile, UTF8)

val fileWithExports =
s"""(function (root, factory) {
s"""(function (root, compiler) {
| if (typeof define === 'function' && define.amd) {
| define([], factory);
| define([], function() { return compiler; });
| } else if (typeof module === 'object' && module.exports) {
| module.exports = factory();
| module.exports = compiler;
| } else {
| root.KaitaiStructCompiler = factory();
| root.KaitaiStructCompiler = compiler;
| }
|}(this, function () {
|
Expand Down
2 changes: 2 additions & 0 deletions js/src/main/scala/io/kaitai/struct/JavaScriptImporter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ package io.kaitai.struct

import scala.scalajs.js
import scala.scalajs.js.Promise
import scala.scalajs.js.annotation.JSGlobal

@js.native
@JSGlobal
class JavaScriptImporter extends js.Object {
def importYaml(name: String, mode: String): Promise[js.Object] = js.native
}
4 changes: 2 additions & 2 deletions js/src/main/scala/io/kaitai/struct/MainJs.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.Future
import scala.scalajs.js
import scala.scalajs.js.JSConverters._
import scala.scalajs.js.annotation.JSExport
import scala.scalajs.js.annotation.{JSExport, JSExportTopLevel}

@JSExport
@JSExportTopLevel("MainJs")
object MainJs {
KSVersion.current = Version.version

Expand Down

0 comments on commit d10b795

Please sign in to comment.