mirror of
https://github.com/hensm/fx_cast.git
synced 2026-06-11 18:19:58 +00:00
Convert mirroringCast sender to typescript
This commit is contained in:
@@ -26,9 +26,10 @@ import { AutoJoinPolicy
|
||||
|
||||
import * as media from "./media";
|
||||
|
||||
import { requestSession as requestSessionTimeout } from "../timeout";
|
||||
|
||||
import { ReceiverSelectorMediaType }
|
||||
from "../../receiver_selectors/ReceiverSelector";
|
||||
import { onMessage, sendMessageResponse } from "../messageBridge";
|
||||
import { requestSession as requestSessionTimeout } from "../timeout";
|
||||
|
||||
|
||||
type ReceiverActionListener = (
|
||||
@@ -37,7 +38,7 @@ type ReceiverActionListener = (
|
||||
|
||||
type RequestSessionSuccessCallback = (
|
||||
session: Session
|
||||
, selectedMedia: string) => void;
|
||||
, selectedMedia: ReceiverSelectorMediaType) => void;
|
||||
|
||||
type SuccessCallback = () => void;
|
||||
type ErrorCallback = (err: Error_) => void;
|
||||
@@ -95,6 +96,7 @@ export function initialize (
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
apiConfig = newApiConfig;
|
||||
|
||||
sendMessageResponse({
|
||||
@@ -209,8 +211,10 @@ onMessage(async message => {
|
||||
|
||||
receiverList.push(receiver);
|
||||
|
||||
// Notify listeners of new cast destination
|
||||
apiConfig.receiverListener(ReceiverAvailability.AVAILABLE);
|
||||
if (apiConfig) {
|
||||
// Notify listeners of new cast destination
|
||||
apiConfig.receiverListener(ReceiverAvailability.AVAILABLE);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -224,8 +228,10 @@ onMessage(async message => {
|
||||
receiver => receiver.id !== message.data.id);
|
||||
|
||||
if (receiverList.length === 0) {
|
||||
apiConfig.receiverListener(
|
||||
ReceiverAvailability.UNAVAILABLE);
|
||||
if (apiConfig) {
|
||||
apiConfig.receiverListener(
|
||||
ReceiverAvailability.UNAVAILABLE);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user