Added better logging and browser support.
We still need to work on the Linux browser a bit.
This commit is contained in:
@@ -1,29 +1,20 @@
|
||||
var port = browser.runtime.connectNative("universal_music")
|
||||
console.log("Hello from Universal Music addon!")
|
||||
/*
|
||||
On startup, connect to the "ping_pong" app.
|
||||
*/
|
||||
var port = browser.runtime.connectNative("universalmusic");
|
||||
|
||||
/**
|
||||
* Sends a message to the application
|
||||
*/
|
||||
function writeMessage(message)
|
||||
{
|
||||
port.postMessage(message)
|
||||
}
|
||||
/*
|
||||
Listen for messages from the app.
|
||||
*/
|
||||
port.onMessage.addListener((response) => {
|
||||
console.log("Received: " + response);
|
||||
});
|
||||
|
||||
/**
|
||||
* 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);
|
||||
/*
|
||||
On a click on the browser action, send the app a message.
|
||||
*/
|
||||
browser.browserAction.onClicked.addListener(() => {
|
||||
console.log("Sending: ping");
|
||||
port.postMessage("ping");
|
||||
});
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"name": "universal_music",
|
||||
"description": "A link between the Universal Music Player and the web browser.",
|
||||
"path": "${LINK_PATH}",
|
||||
"type": "stdio",
|
||||
"allowed_extensions": ["universal_music@regis.edu"]
|
||||
}
|
||||
@@ -13,7 +13,7 @@
|
||||
},
|
||||
"browser_specific_settings": {
|
||||
"gecko": {
|
||||
"id": "universal_music@regis.edu",
|
||||
"id": "universalmusic@regis.edu",
|
||||
"strict_min_version": "55.0"
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user