mirror of
https://github.com/hensm/fx_cast.git
synced 2026-06-10 09:39:58 +00:00
31 lines
690 B
JavaScript
Executable File
31 lines
690 B
JavaScript
Executable File
"use strict";
|
|
|
|
import cast from "./cast";
|
|
import media from "./media";
|
|
|
|
import { onMessage } from "./messageBridge";
|
|
|
|
|
|
if (!window.chrome) {
|
|
window.chrome = {};
|
|
}
|
|
|
|
window.chrome.cast = cast;
|
|
window.chrome.cast.media = media;
|
|
|
|
|
|
onMessage(message => {
|
|
switch (message.subject) {
|
|
case "shim:/initialized": {
|
|
const bridgeInfo = message.data;
|
|
|
|
// Call page's API loaded function if defined
|
|
const readyFunction = window.__onGCastApiAvailable;
|
|
if (readyFunction && typeof readyFunction === "function") {
|
|
readyFunction(bridgeInfo && bridgeInfo.isVersionCompatible);
|
|
}
|
|
break;
|
|
};
|
|
}
|
|
});
|