Add stubbed cast.framework API implementation

This commit is contained in:
hensm
2019-03-19 16:32:09 +00:00
parent 89fc20f6a3
commit 270d661de0
20 changed files with 605 additions and 21 deletions

View File

@@ -14,6 +14,21 @@ if (!global.chrome) {
global.chrome.cast = cast;
if (document.currentScript) {
const currentScript = (document.currentScript as HTMLScriptElement);
const currentScriptUrl = new URL(currentScript.src);
const currentScriptParams = new URLSearchParams(currentScriptUrl.search);
// Load Framework API if requested
if (currentScriptParams.get("loadCastFramework") === "1") {
import("./framework").then(framework => {
global.cast = {};
global.cast.framework = framework.default;
});
}
}
onMessage(message => {
switch (message.subject) {
case "shim:/initialized": {