lucidd on master
Update scala 2.11.11 to 2.11.12 (compare)
lucidd on master
update versions (compare)
chrome.storage.Storage.local.set(Map("hello" -> "world")).foreach(println)
chrome.storage.Storage.local.get(Array("hello")).foreach(println)
import chrome._
import chrome.permissions.Permission
import chrome.permissions.Permission.API
import net.lullabyte.{Chrome, ChromeSbtPlugin}
lazy val root = project.in(file("."))
.enablePlugins(ChromeSbtPlugin)
.settings(
name := "sn",
version := "0.1.0",
scalaVersion := "2.11.8",
scalacOptions ++= Seq(
"-language:implicitConversions",
"-language:existentials",
"-Xlint",
"-deprecation",
"-Xfatal-warnings",
"-feature"
),
persistLauncher := true,
persistLauncher in Test := false,
relativeSourceMaps := true,
libraryDependencies ++= Seq(
"net.lullabyte" %%% "scala-js-chrome" % "0.4.0" withSources() withJavadoc(),
"com.github.japgolly.scalajs-react" %%% "core" % "0.11.3" withSources() withJavadoc(),
"com.github.japgolly.scalajs-react" %%% "extra" % "0.11.3" withSources() withJavadoc()
),
jsDependencies += "org.webjars" % "react" % "0.13.3" / "react-with-addons.min.js" commonJSName "React",
skip in packageJSDependencies := false,
chromeManifest := new ExtensionManifest {
val background = Background(
scripts = Chrome.defaultScripts
)
val name = Keys.name.value
val version = Keys.version.value
override val permissions = Set[Permission](
API.Tabs,
API.Management
)
}
)
bundlerExtension/chromeUnpackedFast::webpack
and then be able to load the directory in target/chrome/unpacked-fast
as an unpacked extension as expected, but there are clearly some more configuring i need to do to make that work. Does that make more sense/help clarify?
Hello, I'm a scalajs newb (and not really skilled in JS either). I'm trying to create a chrome extension using scala-js-chrome
I got a general idea on how to work with the ChromeApp API and how to create windows but I would like to actually create an extension that listens to events in all the tabs. I saw how to do this in JS through CodeInjection. My problem is that, while the wrapper wraps the corresponding call "executeScript", I don't know how to pass the actual code to execute. The options available are through a string and through a filename. ( https://github.com/lucidd/scala-js-chrome/blob/master/bindings/src/main/scala/chrome/tabs/bindings/CodeInjectionOptions.scala )
In my newbiness I have no idea how to do so through scalajs
Runtime.sendMessage(message = "hi")
is giving me an error: Error in event handler for runtime.onMessage: Error: Invalid arguments to sendMessage.
at $c_Lchrome_runtime_Runtime$.sendMessage__sjs_js_UndefOr__sjs_js_Any__sjs_js_UndefOr__sjs_js_UndefOr__V
that's hard to parse
I've downloaded this example: https://github.com/kramer425/scala-js-chrome-extension-example
and modified this file: ./chrome-background-example/src/main/scala/Main.scala
with this very simple program:
import scala.scalajs.js.JSApp
object Main extends JSApp {
def main(): Unit = {
println(chrome.app.window.Window.getAll.length)
}
}
When I install the extension, the background program fails with:
main.js:1151 Uncaught TypeError: Cannot read property 'onBoundsChanged' of undefined
at $c_Lchrome_app_window_Window$.init___ (main.js:1151)
at $m_Lchrome_app_window_Window$ (main.js:1178)
at $c_LMain$.main__V (main.js:1687)
at main.js:2990
at main.js:2991
Any idea?