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 <steverep@users.noreply.github.com>
Co-authored-by: Bram Kragten <mail@bramkragten.nl>
This commit is contained in:
renovate[bot] 2023-05-30 09:30:04 +00:00 committed by GitHub
parent c358d724a7
commit 26d4839dfd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 18 additions and 20 deletions

View File

@ -1,4 +1,4 @@
export {}; // for Babel to treat as a module
import { cast } from "chromecast-caf-receiver";
const castContext = cast.framework.CastReceiverContext.getInstance();

View File

@ -1,2 +1,3 @@
/* eslint-disable no-undef */
import { cast } from "chromecast-caf-receiver";
export const castContext = cast.framework.CastReceiverContext.getInstance();

View File

@ -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";

View File

@ -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",

View File

@ -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;

View File

@ -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