Permalink
Browse files

Monkey Patching

  • Loading branch information...
sadhen committed Jan 1, 2017
1 parent a829234 commit 074682b2dd551a94c2a573877c940f7a01716b8d
View
@@ -39,6 +39,7 @@ lazy val client = (project in file("client")).settings(
"org.scala-lang.modules" % "scala-xml_2.11" % "1.0.6",
"com.thoughtworks.binding" %%% "dom" % "10.0.0-M1",
"com.thoughtworks.binding" %%% "futurebinding" % "10.0.0-M1",
"be.doeraene" %%% "scalajs-jquery" % "0.9.1",
"fr.hmil" %%% "roshttp" % "1.1.0"
)
).enablePlugins(ScalaJSPlugin, ScalaJSWeb).
@@ -5,6 +5,7 @@ import com.thoughtworks.binding.dom
import org.scalajs.dom.document
import org.scalajs.dom.ext.Ajax
import org.scalajs.dom.raw.Event
import org.scalajs.jquery.jQuery
import scala.scalajs.concurrent.JSExecutionContext.Implicits.queue
import scala.scalajs.js
@@ -47,5 +48,7 @@ object ScalaJSExample extends js.JSApp {
def main(): Unit = {
dom.render(document.body, render)
import SemanticUI.jq2semantic
jQuery(".ui.dropdown").dropdown(js.Dynamic.literal(on = "hover"))
}
}
@@ -0,0 +1,17 @@
package example
import org.scalajs.jquery.JQuery
import scala.scalajs.js
/**
* Created by rendong on 17/1/2.
*/
object SemanticUI {
@js.native
trait SemanticJQuery extends JQuery {
def dropdown(params: js.Any*): SemanticJQuery = js.native
}
implicit def jq2semantic(jq: JQuery): SemanticJQuery = jq.asInstanceOf[SemanticJQuery]
}
View
@@ -12,7 +12,7 @@ addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.5.6")
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.3")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.12")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.13")
addSbtPlugin("com.vmunier" % "sbt-web-scalajs" % "1.0.1")

0 comments on commit 074682b

Please sign in to comment.