Skip to content

Instantly share code, notes, and snippets.

View mcdoyaji's full-sized avatar

mcdoyaji mcdoyaji

View GitHub Profile
// 점과 면이 있다.
case class Point(x: Double, y: Double)
case class Dimension(width: Double, height: Double) {
override def toString: String = s"Dimension(width: $width, height: $height)"
}
// 요소와 경계가 있다.
case class Element(x: Double, y: Double, width: Double, height: Double)
case class Bound(x: Double, y: Double, width: Double, height: Double) {
// 점과 면이 있다.
case class Point(x: Double, y: Double)
case class Dimension(width: Double, height: Double) {
override def toString: String = s"Dimension(width: $width, height: $height)"
}
// 요소와 경계가 있다.
case class Element(x: Double, y: Double, width: Double, height: Double)
case class Bounds(x: Double, y: Double, width: Double, height: Double) {
object Daddy{
val objName = "Singleton Object Instance!!"
def apply(name:String) = new Daddy(name)
def apply(name:String, name2: String) = new Mommy(name, name2)
def printName(person:Daddy) { println(person.name)}
def printName(person:Mommy) { println(person.name)}
}
trait Person{
// -----------------------------------------------
// scalaJS 로 스칼라 오브젝트, 클래스, 메소드 등을
// JS 로 내보내기 예제
// ------------------------------------------------
import js.annotation.JSExport
import js.annotation.JSExportNamed
import js.annotation.JSExportAll
import scala.annotation.meta.field
import js.annotation.JSExportDescendentObjects
@mcdoyaji
mcdoyaji / ConvertJSobjectAndScalaObject
Last active November 4, 2015 13:12
상단 파일레벨 주석 표시 추가
//-----------------------------------------------
// 스칼라 JS 객체와 스칼라 객체 간 변환 예제코드
//-----------------------------------------------
import scala.scalajs.js
import js.JSConverters._
object ScalaJSExample extends js.JSApp{
def main() = {