mirror of
https://github.com/hensm/fx_cast.git
synced 2026-06-12 02:29:59 +00:00
Narrow linting rules and fix for eslintrc for js files
This commit is contained in:
@@ -7,6 +7,10 @@ import cast, { ensureInit } from "../../export";
|
||||
import { Message } from "../../../messaging";
|
||||
import { ReceiverDevice } from "../../../types";
|
||||
|
||||
import type Session from "../../sdk/Session";
|
||||
import type Media from "../../sdk/media/Media";
|
||||
import type { Error as Error_ } from "../../sdk/classes";
|
||||
|
||||
function startMediaServer(
|
||||
filePath: string,
|
||||
port: number
|
||||
@@ -49,12 +53,12 @@ function startMediaServer(
|
||||
|
||||
let backgroundPort: MessagePort;
|
||||
|
||||
let currentSession: cast.Session;
|
||||
let currentMedia: cast.media.Media;
|
||||
let currentSession: Session;
|
||||
let currentMedia: Media;
|
||||
|
||||
let targetElement: HTMLElement;
|
||||
|
||||
function getSession(opts: InitOptions): Promise<cast.Session> {
|
||||
function getSession(opts: InitOptions): Promise<Session> {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
/**
|
||||
* If a receiver is available, call requestSession. If a
|
||||
@@ -76,10 +80,10 @@ function getSession(opts: InitOptions): Promise<cast.Session> {
|
||||
// TODO: Handle this
|
||||
}
|
||||
|
||||
function onRequestSessionSuccess(session: cast.Session) {
|
||||
function onRequestSessionSuccess(session: Session) {
|
||||
resolve(session);
|
||||
}
|
||||
function onRequestSessionError(err: cast.Error) {
|
||||
function onRequestSessionError(err: Error_) {
|
||||
reject(err.description);
|
||||
}
|
||||
|
||||
@@ -97,7 +101,7 @@ function getSession(opts: InitOptions): Promise<cast.Session> {
|
||||
});
|
||||
}
|
||||
|
||||
function getMedia(opts: InitOptions): Promise<cast.media.Media> {
|
||||
function getMedia(opts: InitOptions): Promise<Media> {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
let mediaUrl = new URL(opts.mediaUrl);
|
||||
const mediaTitle = mediaUrl.pathname.slice(1);
|
||||
|
||||
@@ -6,6 +6,8 @@ import cast, { ensureInit } from "../export";
|
||||
import { ReceiverSelectorMediaType } from "../../background/receiverSelector";
|
||||
import { ReceiverDevice } from "../../types";
|
||||
|
||||
import type Session from "../sdk/Session";
|
||||
|
||||
// Variables passed from background
|
||||
const {
|
||||
selectedMedia,
|
||||
@@ -17,7 +19,7 @@ const {
|
||||
|
||||
const FX_CAST_RECEIVER_APP_NAMESPACE = "urn:x-cast:fx_cast";
|
||||
|
||||
let session: cast.Session;
|
||||
let session: Session;
|
||||
let wasSessionRequested = false;
|
||||
|
||||
let peerConnection: RTCPeerConnection;
|
||||
@@ -26,7 +28,7 @@ let peerConnection: RTCPeerConnection;
|
||||
* Sends a message to the fx_cast app running on the
|
||||
* receiver device.
|
||||
*/
|
||||
function sendAppMessage(subject: string, data: any) {
|
||||
function sendAppMessage(subject: string, data: unknown) {
|
||||
if (!session) {
|
||||
return;
|
||||
}
|
||||
@@ -41,7 +43,7 @@ window.addEventListener("beforeunload", () => {
|
||||
sendAppMessage("close", null);
|
||||
});
|
||||
|
||||
async function onRequestSessionSuccess(newSession: cast.Session) {
|
||||
async function onRequestSessionSuccess(newSession: Session) {
|
||||
cast.logMessage("onRequestSessionSuccess");
|
||||
|
||||
session = newSession;
|
||||
|
||||
Reference in New Issue
Block a user