oyvindberg on docs-object
Builders: initialize `null` cor… Builders: initialize `literals`… Docs: Working with objects (compare)
oyvindberg on limit-literal-strings
oyvindberg on master
Limit how many fake literal str… (compare)
oyvindberg on master
Update scala-library to 2.12.13… (compare)
oyvindberg on more-js-dynamic
oyvindberg on master
More usage of js.Dynamic instea… (compare)
oyvindberg on limit-literal-strings
Limit how many fake literal str… (compare)
oyvindberg on more-js-dynamic
More usage of js.Dynamic instea… (compare)
oyvindberg on master
Update os-lib to 0.7.3 (#257) (compare)
oyvindberg on more-js-dynamic
More usage of js.Dynamic instea… (compare)
oyvindberg on fix-echarts
oyvindberg on master
fix echarts (#255) (compare)
oyvindberg on fix-echarts
fix echarts (compare)
oyvindberg on fix-echarts
fix echarts (compare)
oyvindberg on fix-echarts
fix echarts (compare)
oyvindberg on master
Update scalatest to 3.2.5 (#253) (compare)
oyvindberg on dotty-support
bump versions (compare)
oyvindberg on dotty-support
fix test (compare)
oyvindberg on dotty-support
disable wildcards in a more cle… (compare)
oyvindberg on dotty-support
disable wildcards, ensure metho… (compare)
ScalablyTypedConverterGenSourcePlugin
with stSourceGenMode := SourceGenMode.Manual
and stFlavour := Flavour.Japgolly
-Ymacro-annotations
. Removing that option then everything compiles well
So whilst the original JS version looks like this:
var cy = cytoscape({
container: document.getElementById('cy'),
elements: [
{ data: { id: 'a' } },
{ data: { id: 'b' } },
{
data: {
id: 'ab',
source: 'a',
target: 'b'
}
}]
});
With ScalablyTyped my code looks like this:
import typings.cytoscape.mod.{apply => cytoscape, _}
val cy: Core = cytoscape(new CytoscapeOptions {
container = document.getElementById("cy").asInstanceOf[HTMLElement]
elements = js.Array(
ElementDefinition(NodeDataDefinition().setId("a")),
ElementDefinition(NodeDataDefinition().setId("b")),
ElementDefinition(EdgeDataDefinition("a", "b")))
})
@oyvindberg How can I help the converter out to generate less awkward code?
import org.scalajs.dom.document
import org.scalajs.dom.raw.HTMLElement
import typings.cytoscape.mod.{apply => cytoscape, _}
val cy: Core = cytoscape(
CytoscapeOptions()
.setContainer(document.getElementById("container").asInstanceOf[HTMLElement])
.setElementsVarargs(
ElementDefinition(NodeDataDefinition().setId("a")),
ElementDefinition(NodeDataDefinition().setId("b")),
ElementDefinition(EdgeDataDefinition("a", "b"))
)
)
@oyvindberg oh neat, I'll check that out tomorrow! Fwiw I was able to still use scalajs-bundler, after adding:webpackBundlingMode := BundlingMode.LibraryAndApplication()
and using./target/scala-2.13/scalajs-bundler/main/scala-js-tutorial-fastopt-bundle.js
(and then)~fastOptJS::webpack
.
I also setstEnableScalaJsDefined := Selection.NoneExcept("cytoscape")
stEnableScalaJsDefined
by the way
scalaJSLinkerConfig ~= (_.withSourceMap(false))
.