From 1ced9aafc00c10992bab8bd3f1b6b1397f05b7b9 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Tue, 19 Dec 2023 00:33:38 -0500 Subject: Make JSON.parse usage safer (#373) * Make JSON.parse usage safer * Fix any type * Add readResponseJson * Use readResponseJson * Additional updates * Rename files * Add types --- types/ext/api.d.ts | 2 +- types/ext/audio-downloader.d.ts | 10 ++++++++++ types/ext/cross-frame-api.d.ts | 13 +++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) (limited to 'types/ext') diff --git a/types/ext/api.d.ts b/types/ext/api.d.ts index 6b7b4b19..2d78cc06 100644 --- a/types/ext/api.d.ts +++ b/types/ext/api.d.ts @@ -467,6 +467,6 @@ export type RequestBackendReadySignalResult = boolean; export type CreateActionPortDetails = Record; export type CreateActionPortResult = { - name: string; + name: 'action-port'; id: string; }; diff --git a/types/ext/audio-downloader.d.ts b/types/ext/audio-downloader.d.ts index b8e812f8..dfda8cb9 100644 --- a/types/ext/audio-downloader.d.ts +++ b/types/ext/audio-downloader.d.ts @@ -42,3 +42,13 @@ export type AudioBinaryBase64 = { data: string; contentType: string | null; }; + +export type CustomAudioList = { + type: 'audioSourceList'; + audioSources: CustomAudioListSource[]; +}; + +export type CustomAudioListSource = { + url: string; + name?: string; +}; diff --git a/types/ext/cross-frame-api.d.ts b/types/ext/cross-frame-api.d.ts index 88ce59a7..e31079b7 100644 --- a/types/ext/cross-frame-api.d.ts +++ b/types/ext/cross-frame-api.d.ts @@ -52,3 +52,16 @@ export type Invocation = { ack: boolean; timer: Core.Timeout | null; }; + +export type PortDetails = CrossFrameCommunicationPortDetails | ActionPortDetails; + +export type CrossFrameCommunicationPortDetails = { + name: 'cross-frame-communication-port'; + otherTabId: number; + otherFrameId: number; +}; + +export type ActionPortDetails = { + name: 'action-port'; + id: string; +}; -- cgit v1.2.3