You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm currently developing a browser plugin for firefox.
As firefox (as well as chrome, etc.) has different scopes for the DOM of normal pages and the DOM accessed by the plugin, the plugin can only interact with the page through message passing (so no invocations on objects).. basically a perfect use case for Akka(.js).
Is it possible to spawn an ActorSystem in the scope of the page and one in the scope of the plugin and let them communicate?
The text was updated successfully, but these errors were encountered:
domdorn
changed the title
can this be used for browser plugins?
[Question] can this be used for browser plugins?
Feb 20, 2020
so my current approach would be something like this.. not sure if that actually works
handle the actual tab
1a) create a script that loads the scala.js and akka.js dependencies
1b) create a script that creates an ActorSystem('akkabrowser') and bind it to something like window.akka.akkabrowser .
1c) do a
document.addEventListener('akkabrowser', function(e) {
val message = e.detail
ActorRef(message.destination).forward(message.payload, message.sender)(window.akka.akkabrowser)
})
handle the foreground script in the extension
2a) create a script that creates an ActorSystem('akkapluginfe') and bind it to something like window.akka.akkapluginfe
2b) do a
document.addEventListener('akkapluginfe', function(e) {
val message = e.detail
ActorRef(message.destination).forward(message.payload, message.sender)(window.akka.akkapluginfe)
})
handle background scripts in the extension // TODO ..
create some code similar to akka-remote that transforms a non-local message to something like
val envelope = ....
val targetActorSystem = extractActorSystem(envelope.destination)
val customEvent = new CustomEvent(targetActorSystem, {detail: {
destination = envelope.destination
payload = envelope.message
sender = createAbsoluteSender(envelope.sender)
}}
document.dispatchEvent(customEvent);
I'm currently developing a browser plugin for firefox.
As firefox (as well as chrome, etc.) has different
scopes
for the DOM of normal pages and the DOM accessed by the plugin, the plugin can only interact with the page through message passing (so no invocations on objects).. basically a perfect use case for Akka(.js).Is it possible to spawn an ActorSystem in the scope of the page and one in the scope of the plugin and let them communicate?
The text was updated successfully, but these errors were encountered: