mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-13 03:11:46 +00:00
plugin system poc
This commit is contained in:
1
src/plugins/utils/common/index.ts
Normal file
1
src/plugins/utils/common/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export * from './types';
|
||||
29
src/plugins/utils/common/types.ts
Normal file
29
src/plugins/utils/common/types.ts
Normal file
@ -0,0 +1,29 @@
|
||||
import type { BrowserWindow } from 'electron';
|
||||
|
||||
export interface Config {
|
||||
enabled: boolean;
|
||||
}
|
||||
|
||||
export interface Plugin<ConfigType extends Config> {
|
||||
name: string;
|
||||
description: string;
|
||||
config: ConfigType;
|
||||
}
|
||||
|
||||
export interface RendererPlugin<ConfigType extends Config> extends Plugin<ConfigType> {
|
||||
onEnable: (config: ConfigType) => void;
|
||||
}
|
||||
|
||||
export interface MainPlugin<ConfigType extends Config> extends Plugin<ConfigType> {
|
||||
onEnable: (window: BrowserWindow, config: ConfigType) => string;
|
||||
}
|
||||
|
||||
export interface PreloadPlugin<ConfigType extends Config> extends Plugin<ConfigType> {
|
||||
onEnable: (config: ConfigType) => void;
|
||||
}
|
||||
|
||||
export interface MenuPlugin<ConfigType extends Config> extends Plugin<ConfigType> {
|
||||
onEnable: (config: ConfigType) => void;
|
||||
}
|
||||
|
||||
export const defineConfig = <ConfigType extends Config>(config: ConfigType) => config;
|
||||
Reference in New Issue
Block a user