Skip to content
This repository was archived by the owner on Jun 4, 2025. It is now read-only.

Commit bfaaafc

Browse files
committed
Added somewhat of a RPC/launch args
1 parent a12dcdc commit bfaaafc

2 files changed

Lines changed: 21 additions & 2 deletions

File tree

manifest.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
"scripts": ["static/js/jquery-2.2.0.min.js", "static/js/material.min.js", "static/js/common.js", "static/js/background.js"]
1919
}
2020
},
21+
"externally_connectable": {
22+
"matches": ["*://localhost:*/*", "*://moonlight-stream.com:*/*", "*://moonlight-stream.github.io:*/*"]
23+
},
2124
"sockets": {
2225
"udp": { "bind": "*", "send": "*" }
2326
},

static/js/background.js

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ function createWindow(state) {
1717
});
1818
}
1919

20-
chrome.app.runtime.onLaunched.addListener(function() {
21-
console.log('Chrome app runtime launched.');
20+
function launchApp() {
2221
var windowState = 'normal';
2322

2423
if (chrome.storage) {
@@ -32,4 +31,21 @@ chrome.app.runtime.onLaunched.addListener(function() {
3231
} else {
3332
createWindow(windowState);
3433
}
34+
}
35+
36+
chrome.app.runtime.onLaunched.addListener(function() {
37+
console.log('Chrome app runtime launched.');
38+
launchApp()
3539
});
40+
41+
chrome.runtime.onMessageExternal.addListener(function(request, sender, sendResponse) {
42+
if(request && request.message) {
43+
if(request.message == 'VERSION') {
44+
var manifestData = chrome.runtime.getManifest();
45+
sendResponse({name: 'moonlight-chrome', version: manifestData.version})
46+
}
47+
if(request.message == 'LAUNCH') {
48+
launchApp()
49+
}
50+
}
51+
})

0 commit comments

Comments
 (0)