mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Make a channel have default type for sent and returned message
Co-authored-by: Janne Savolainen <janne.savolainen@live.fi> Signed-off-by: Iku-turso <mikko.aspiala@gmail.com>
This commit is contained in:
parent
348b214ca0
commit
ec2d2056cb
@ -13,7 +13,7 @@ export type ApplicationUpdateStatusEventId =
|
|||||||
| "download-for-update-failed";
|
| "download-for-update-failed";
|
||||||
|
|
||||||
export interface ApplicationUpdateStatusChannelMessage { eventId: ApplicationUpdateStatusEventId; version?: string }
|
export interface ApplicationUpdateStatusChannelMessage { eventId: ApplicationUpdateStatusEventId; version?: string }
|
||||||
export type ApplicationUpdateStatusChannel = Channel<ApplicationUpdateStatusChannelMessage, never>;
|
export type ApplicationUpdateStatusChannel = Channel<ApplicationUpdateStatusChannelMessage>;
|
||||||
|
|
||||||
const applicationUpdateStatusChannelInjectable = getInjectable({
|
const applicationUpdateStatusChannelInjectable = getInjectable({
|
||||||
id: "application-update-status-channel",
|
id: "application-update-status-channel",
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import { getInjectable } from "@ogre-tools/injectable";
|
|||||||
import type { Channel } from "../channel/channel-injection-token";
|
import type { Channel } from "../channel/channel-injection-token";
|
||||||
import { channelInjectionToken } from "../channel/channel-injection-token";
|
import { channelInjectionToken } from "../channel/channel-injection-token";
|
||||||
|
|
||||||
type AskBooleanAnswerChannel = Channel<{ id: string; value: boolean }, never>;
|
type AskBooleanAnswerChannel = Channel<{ id: string; value: boolean }>;
|
||||||
|
|
||||||
const askBooleanAnswerChannelInjectable = getInjectable({
|
const askBooleanAnswerChannelInjectable = getInjectable({
|
||||||
id: "ask-boolean-answer-channel",
|
id: "ask-boolean-answer-channel",
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import type { Channel } from "../channel/channel-injection-token";
|
|||||||
import { channelInjectionToken } from "../channel/channel-injection-token";
|
import { channelInjectionToken } from "../channel/channel-injection-token";
|
||||||
|
|
||||||
export interface AskBooleanQuestionParameters { id: string; title: string; question: string }
|
export interface AskBooleanQuestionParameters { id: string; title: string; question: string }
|
||||||
export type AskBooleanQuestionChannel = Channel<AskBooleanQuestionParameters, never>;
|
export type AskBooleanQuestionChannel = Channel<AskBooleanQuestionParameters>;
|
||||||
|
|
||||||
const askBooleanQuestionChannelInjectable = getInjectable({
|
const askBooleanQuestionChannelInjectable = getInjectable({
|
||||||
id: "ask-boolean-question-channel",
|
id: "ask-boolean-question-channel",
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import { getInjectionToken } from "@ogre-tools/injectable";
|
import { getInjectionToken } from "@ogre-tools/injectable";
|
||||||
|
|
||||||
export interface Channel<MessageTemplate, ReturnTemplate> {
|
export interface Channel<MessageTemplate = void, ReturnTemplate = void> {
|
||||||
id: string;
|
id: string;
|
||||||
_messageTemplate?: MessageTemplate;
|
_messageTemplate?: MessageTemplate;
|
||||||
_returnTemplate?: ReturnTemplate;
|
_returnTemplate?: ReturnTemplate;
|
||||||
|
|||||||
@ -14,7 +14,7 @@ import createLensWindowInjectable from "../../main/start-main-application/lens-w
|
|||||||
import type { Channel } from "./channel-injection-token";
|
import type { Channel } from "./channel-injection-token";
|
||||||
import closeAllWindowsInjectable from "../../main/start-main-application/lens-window/hide-all-windows/close-all-windows.injectable";
|
import closeAllWindowsInjectable from "../../main/start-main-application/lens-window/hide-all-windows/close-all-windows.injectable";
|
||||||
|
|
||||||
type TestChannel = Channel<string, never>;
|
type TestChannel = Channel<string>;
|
||||||
|
|
||||||
describe("channel", () => {
|
describe("channel", () => {
|
||||||
describe("messaging from main to renderer, given listener for channel in a window and application has started", () => {
|
describe("messaging from main to renderer, given listener for channel in a window and application has started", () => {
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import type { Channel } from "../channel/channel-injection-token";
|
|||||||
import { channelInjectionToken } from "../channel/channel-injection-token";
|
import { channelInjectionToken } from "../channel/channel-injection-token";
|
||||||
import { IpcRendererNavigationEvents } from "../../renderer/navigation/events";
|
import { IpcRendererNavigationEvents } from "../../renderer/navigation/events";
|
||||||
|
|
||||||
export type AppNavigationChannel = Channel<string, never>;
|
export type AppNavigationChannel = Channel<string>;
|
||||||
|
|
||||||
const appNavigationChannelInjectable = getInjectable({
|
const appNavigationChannelInjectable = getInjectable({
|
||||||
id: "app-navigation-channel",
|
id: "app-navigation-channel",
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import type { Channel } from "../channel/channel-injection-token";
|
|||||||
import { channelInjectionToken } from "../channel/channel-injection-token";
|
import { channelInjectionToken } from "../channel/channel-injection-token";
|
||||||
import { IpcRendererNavigationEvents } from "../../renderer/navigation/events";
|
import { IpcRendererNavigationEvents } from "../../renderer/navigation/events";
|
||||||
|
|
||||||
export type ClusterFrameNavigationChannel = Channel<string, never>;
|
export type ClusterFrameNavigationChannel = Channel<string>;
|
||||||
|
|
||||||
const clusterFrameNavigationChannelInjectable = getInjectable({
|
const clusterFrameNavigationChannelInjectable = getInjectable({
|
||||||
id: "cluster-frame-navigation-channel",
|
id: "cluster-frame-navigation-channel",
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import { getInjectable } from "@ogre-tools/injectable";
|
|||||||
import type { Channel } from "../channel/channel-injection-token";
|
import type { Channel } from "../channel/channel-injection-token";
|
||||||
import { channelInjectionToken } from "../channel/channel-injection-token";
|
import { channelInjectionToken } from "../channel/channel-injection-token";
|
||||||
|
|
||||||
export type RootFrameRenderedChannel = Channel<void, never>;
|
export type RootFrameRenderedChannel = Channel;
|
||||||
|
|
||||||
const rootFrameRenderedChannelInjectable = getInjectable({
|
const rootFrameRenderedChannelInjectable = getInjectable({
|
||||||
id: "root-frame-rendered-channel",
|
id: "root-frame-rendered-channel",
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import { getInjectable } from "@ogre-tools/injectable";
|
|||||||
import type { Channel } from "../channel/channel-injection-token";
|
import type { Channel } from "../channel/channel-injection-token";
|
||||||
import { channelInjectionToken } from "../channel/channel-injection-token";
|
import { channelInjectionToken } from "../channel/channel-injection-token";
|
||||||
|
|
||||||
export type SyncBoxChannel = Channel<{ id: string; value: unknown }, never>;
|
export type SyncBoxChannel = Channel<{ id: string; value: unknown }>;
|
||||||
|
|
||||||
const syncBoxChannelInjectable = getInjectable({
|
const syncBoxChannelInjectable = getInjectable({
|
||||||
id: "sync-box-channel",
|
id: "sync-box-channel",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user