Last active
November 4, 2015 13:12
-
-
Save mcdoyaji/b4804f9f5ae0c8253917 to your computer and use it in GitHub Desktop.
상단 파일레벨 주석 표시 추가
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//----------------------------------------------- | |
// 스칼라 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