Skip to content

Instantly share code, notes, and snippets.

@zygm0nt
Created November 6, 2017 08:11
Show Gist options
  • Save zygm0nt/2abd22e585a1c665ef8f7ab1ab473daa to your computer and use it in GitHub Desktop.
Save zygm0nt/2abd22e585a1c665ef8f7ab1ab473daa to your computer and use it in GitHub Desktop.
cytoscape-facade.scala
import org.scalajs.dom.html.{Div, Element}
import scala.scalajs.js
import scala.scalajs.js.annotation.JSName
package object graph {
@js.native
@JSName("cytoscape")
object CytoscapeStatic extends js.Object {
//def add(elements: js.Array[GraphElement]): js.Dynamic = js.native
// def add(elements: GraphElement): js.Dynamic = js.native
def apply(container: Element): Cytoscape = js.native
}
@js.native
trait Cytoscape extends js.Object {
def add(events: GraphElement): GraphElement = js.native
}
@js.native
trait GraphElement extends js.Object {
def group: String = js.native
def data: ElementData = js.native
def position: Option[PositionData] = js.native
}
@js.native
trait ElementData extends js.Object {
def id: String = js.native
def source: Option[String] = js.native
def target: Option[String] = js.native
}
@js.native
trait PositionData extends js.Object {
def x: Int = js.native
def y: Int = js.native
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment