Skip to content

Instantly share code, notes, and snippets.

@mcdoyaji
Last active November 4, 2015 13:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mcdoyaji/b4804f9f5ae0c8253917 to your computer and use it in GitHub Desktop.
Save mcdoyaji/b4804f9f5ae0c8253917 to your computer and use it in GitHub Desktop.
상단 파일레벨 주석 표시 추가
//-----------------------------------------------
// 스칼라 JS 객체와 스칼라 객체 간 변환 예제코드
//-----------------------------------------------
import scala.scalajs.js
import js.JSConverters._
object ScalaJSExample extends js.JSApp{
def main() = {
// 스칼라 list => 스칼라js 배열
val a:js.Array[String] =
Seq("hello")
.toJSArray
// 스칼라 Map => 스칼라js Dictionary
val b:js.Dictionary[String] =
Map("langCode"-> "KO")
.toJSDictionary
// 스칼라 list[Map] => 스칼라js Array[Dictionary]
val c:js.Array[js.Dictionary[String]]=
Seq(Map("langCode"->"KO", "imageName"->"kr.png", "alt"->"Korean", "native"-> "한국어")
.toJSDictionary).toJSArray
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment