Adds some integration with firefox.
This is still rather unstable, but it runs.
This commit is contained in:
29
add-on/background.js
Normal file
29
add-on/background.js
Normal file
@@ -0,0 +1,29 @@
|
||||
var port = browser.runtime.connectNative("universal_music")
|
||||
|
||||
/**
|
||||
* Sends a message to the application
|
||||
*/
|
||||
function writeMessage(message)
|
||||
{
|
||||
port.postMessage(message)
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a message to the application
|
||||
*/
|
||||
function onAppMessage(message)
|
||||
{
|
||||
if ("command" in message)
|
||||
{
|
||||
switch (message["command"])
|
||||
{
|
||||
case "ping":
|
||||
writeMessage({
|
||||
"response": "ping"
|
||||
});
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
port.onMessage.addListener(onAppMessage);
|
||||
Reference in New Issue
Block a user