From 26d4839dfd4f3878efe8e08b7e5a184606fd4a0a Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 30 May 2023 09:30:04 +0000 Subject: [PATCH] Update dependency @types/chromecast-caf-receiver to v6 (#15724) * Update dependency @types/chromecast-caf-receiver to v6 * Import cast namespace from receiver for receiver/media entry * Use sender event types in manager and remove anonymous listeners * Apply suggestions from code review * prettier --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Steve Repsher Co-authored-by: Bram Kragten --- cast/src/media/entrypoint.ts | 2 +- cast/src/receiver/cast_context.ts | 3 ++- cast/src/receiver/entrypoint.ts | 2 +- package.json | 2 +- src/cast/cast_manager.ts | 19 ++++++++----------- yarn.lock | 10 +++++----- 6 files changed, 18 insertions(+), 20 deletions(-) diff --git a/cast/src/media/entrypoint.ts b/cast/src/media/entrypoint.ts index c8b3f51a81..b1f7d75cf8 100644 --- a/cast/src/media/entrypoint.ts +++ b/cast/src/media/entrypoint.ts @@ -1,4 +1,4 @@ -export {}; // for Babel to treat as a module +import { cast } from "chromecast-caf-receiver"; const castContext = cast.framework.CastReceiverContext.getInstance(); diff --git a/cast/src/receiver/cast_context.ts b/cast/src/receiver/cast_context.ts index 931a3353f0..18d79e5edb 100644 --- a/cast/src/receiver/cast_context.ts +++ b/cast/src/receiver/cast_context.ts @@ -1,2 +1,3 @@ -/* eslint-disable no-undef */ +import { cast } from "chromecast-caf-receiver"; + export const castContext = cast.framework.CastReceiverContext.getInstance(); diff --git a/cast/src/receiver/entrypoint.ts b/cast/src/receiver/entrypoint.ts index 1ee46a6f7a..cb8684b414 100644 --- a/cast/src/receiver/entrypoint.ts +++ b/cast/src/receiver/entrypoint.ts @@ -1,4 +1,4 @@ -/* eslint-disable no-undef */ +import { cast } from "chromecast-caf-receiver"; import { CAST_NS } from "../../../src/cast/const"; import { HassMessage } from "../../../src/cast/receiver_messages"; import "../../../src/resources/custom-card-support"; diff --git a/package.json b/package.json index 518252f047..ff049c816d 100644 --- a/package.json +++ b/package.json @@ -165,7 +165,7 @@ "@rollup/plugin-node-resolve": "15.0.2", "@rollup/plugin-replace": "5.0.2", "@types/babel__plugin-transform-runtime": "7.9.2", - "@types/chromecast-caf-receiver": "5.0.12", + "@types/chromecast-caf-receiver": "6.0.9", "@types/chromecast-caf-sender": "1.0.5", "@types/esprima": "4.0.3", "@types/glob": "8.1.0", diff --git a/src/cast/cast_manager.ts b/src/cast/cast_manager.ts index f41811cde1..9d8747543a 100644 --- a/src/cast/cast_manager.ts +++ b/src/cast/cast_manager.ts @@ -1,8 +1,5 @@ -/* eslint-disable no-undef, no-console */ -import { - CastStateEventData, - SessionStateEventData, -} from "chromecast-caf-receiver/cast.framework"; +/* eslint-disable no-console */ + import { Auth } from "home-assistant-js-websocket"; import { castApiAvailable } from "./cast_framework"; import { CAST_APP_ID, CAST_DEV, CAST_NS } from "./const"; @@ -48,11 +45,11 @@ export class CastManager { }); context.addEventListener( cast.framework.CastContextEventType.SESSION_STATE_CHANGED, - (ev) => this._sessionStateChanged(ev) + this._sessionStateChanged ); context.addEventListener( cast.framework.CastContextEventType.CAST_STATE_CHANGED, - (ev) => this._castStateChanged(ev) + this._castStateChanged ); } @@ -119,7 +116,7 @@ export class CastManager { } } - private _sessionStateChanged(ev: SessionStateEventData) { + private _sessionStateChanged = (ev: cast.framework.SessionStateEventData) => { if (__DEV__) { console.log("Cast session state changed", ev.sessionState); } @@ -140,14 +137,14 @@ export class CastManager { this.status = undefined; this._fireEvent("connection-changed"); } - } + }; - private _castStateChanged(ev: CastStateEventData) { + private _castStateChanged = (ev: cast.framework.CastStateEventData) => { if (__DEV__) { console.log("Cast state changed", ev.castState); } this._fireEvent("state-changed"); - } + }; private _attachMessageListener() { const session = this.castSession; diff --git a/yarn.lock b/yarn.lock index 659c038879..80faaf7cdd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4131,10 +4131,10 @@ __metadata: languageName: node linkType: hard -"@types/chromecast-caf-receiver@npm:5.0.12": - version: 5.0.12 - resolution: "@types/chromecast-caf-receiver@npm:5.0.12" - checksum: 2b3c2e85935b3617ceffdb08e336ad6b9e18a9049dad1866f72284df022986cc5f73cc20a561bddc6351df0408e1e4bb946aad2f2cd2c33a8aea872fbbfa4a1f +"@types/chromecast-caf-receiver@npm:6.0.9": + version: 6.0.9 + resolution: "@types/chromecast-caf-receiver@npm:6.0.9" + checksum: c5431edf1c3e52db4ecf6f2a75000bf2eabc3791ee548ad027829cbae8977cd5b1de371bc68eeed22e2adbb72695f46c125bfa8a733fe0f3cf7baf26e0a74370 languageName: node linkType: hard @@ -9690,7 +9690,7 @@ __metadata: "@rollup/plugin-replace": 5.0.2 "@thomasloven/round-slider": 0.6.0 "@types/babel__plugin-transform-runtime": 7.9.2 - "@types/chromecast-caf-receiver": 5.0.12 + "@types/chromecast-caf-receiver": 6.0.9 "@types/chromecast-caf-sender": 1.0.5 "@types/esprima": 4.0.3 "@types/glob": 8.1.0