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
Physics({ timestep: 4 }, function (world) { | |
var viewWidth = window.innerWidth | |
,viewHeight = window.innerHeight | |
,edgeBounce | |
,renderer | |
; | |
// create a renderer | |
renderer = Physics.renderer('canvas', { |
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
object Example { | |
import scala.collection.IndexedSeqLike | |
trait BaseLike | |
class DNABase extends BaseLike | |
trait BioSequence[B <: BaseLike] extends IndexedSeq[B] | |
class DNA extends BioSequence[DNABase] with IndexedSeqLike[DNABase, DNA] { |
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
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.18") | |
addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.7.0") |
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
enablePlugins(ScalaJSBundlerPlugin) | |
resolvers += "Apollo Bintray" at "https://dl.bintray.com/apollographql/maven/" | |
libraryDependencies += "com.apollographql" %%% "react-apollo-scalajs" % "0.1.0" | |
libraryDependencies += "me.shadaj" %%% "slinky-web" % "0.1.0" | |
npmDependencies in Compile += "react" -> "15.6.1" | |
npmDependencies in Compile += "react-dom" -> "15.6.1" |
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
package com.apollographql.scalajs | |
import me.shadaj.slinky.web.ReactDOM | |
import me.shadaj.slinky.web.html._ // imports tags, such as "h1" | |
import scala.scalajs.js.JSApp | |
import org.scalajs.dom.{document, html} | |
import scala.scalajs.js |
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
query AllPosts { | |
posts { | |
id | |
title | |
votes | |
} | |
} |
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
package com.apollographql.scalajs | |
import me.shadaj.slinky.core.StatelessComponent | |
import me.shadaj.slinky.core.facade.ReactElement | |
import me.shadaj.slinky.web.html._ | |
import scala.scalajs.js | |
import scala.scalajs.js.annotation.ScalaJSDefined | |
object PostsView extends StatelessComponent { |
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
val client = ApolloClient(ApolloClientOptions( | |
networkInterface = Some(createNetworkInterface(NetworkInterfaceOptions( | |
uri = Some("https://1jzxrj179.lp.gql.zone/graphql") | |
))) | |
)) |
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
ReactDOM.render( | |
ApolloProvider(ApolloProvider.Props(client))( | |
div( | |
PostsView.WithData(()) // we pass in () because there are no variables for the query | |
) | |
), | |
reactContainer | |
) |
OlderNewer