mirror of
https://github.com/hensm/fx_cast.git
synced 2026-06-10 17:49:58 +00:00
Convert mediaCast sender to typescript
This commit is contained in:
@@ -429,17 +429,17 @@ browser.menus.onClicked.addListener(async (info, tab) => {
|
||||
const { frameId } = info;
|
||||
const mirroringAppId = await options.get("mirroringAppId");
|
||||
|
||||
// Load cast setup script
|
||||
await browser.tabs.executeScript(tab.id, {
|
||||
file: "shim/content.js"
|
||||
, frameId
|
||||
});
|
||||
|
||||
switch (info.menuItemId) {
|
||||
case mirrorCastMenuId: {
|
||||
mirrorCastTabId = tab.id;
|
||||
mirrorCastFrameId = frameId;
|
||||
|
||||
// Load cast setup script
|
||||
await browser.tabs.executeScript(tab.id, {
|
||||
file: "shim/content.js"
|
||||
, frameId
|
||||
});
|
||||
|
||||
await browser.tabs.executeScript(tab.id, {
|
||||
code: `
|
||||
var selectedMedia = ${info.pageUrl
|
||||
@@ -456,6 +456,12 @@ browser.menus.onClicked.addListener(async (info, tab) => {
|
||||
, frameId
|
||||
});
|
||||
|
||||
// Load cast API
|
||||
await browser.tabs.executeScript(tab.id, {
|
||||
file: "shim/bundle.js"
|
||||
, frameId
|
||||
});
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -465,8 +471,10 @@ browser.menus.onClicked.addListener(async (info, tab) => {
|
||||
|
||||
// Pass media URL to media sender app
|
||||
await browser.tabs.executeScript(tab.id, {
|
||||
code: `var srcUrl = "${info.srcUrl}";
|
||||
var targetElementId = ${info.targetElementId};`
|
||||
code: `
|
||||
window.srcUrl = "${info.srcUrl}";
|
||||
window.targetElementId = ${info.targetElementId};
|
||||
`
|
||||
, frameId
|
||||
});
|
||||
|
||||
@@ -480,12 +488,6 @@ browser.menus.onClicked.addListener(async (info, tab) => {
|
||||
}
|
||||
}
|
||||
|
||||
// Load cast API
|
||||
await browser.tabs.executeScript(tab.id, {
|
||||
file: "shim/bundle.js"
|
||||
, frameId
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user