mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-10 10:11:46 +00:00
chore: update README
This commit is contained in:
34
readme.md
34
readme.md
@ -184,23 +184,49 @@ Using plugins, you can:
|
||||
|
||||
Create a folder in `plugins/YOUR-PLUGIN-NAME`:
|
||||
|
||||
- if you need to manipulate the BrowserWindow, create a file `back.ts` with the following template:
|
||||
- if you need to manipulate the BrowserWindow, create a file with the following template:
|
||||
|
||||
```typescript
|
||||
export default (win: Electron.BrowserWindow) => {
|
||||
// file: back.ts
|
||||
export default (win: Electron.BrowserWindow, config: ConfigType<'YOUR-PLUGIN-NAME'>) => {
|
||||
// something
|
||||
};
|
||||
```
|
||||
|
||||
- if you need to change the front, create a file `front.ts` with the following template:
|
||||
then, register the plugin in `index.ts`:
|
||||
|
||||
```typescript
|
||||
export default () => {
|
||||
import yourPlugin from './plugins/YOUR-PLUGIN-NAME/back';
|
||||
|
||||
// ...
|
||||
|
||||
const mainPlugins = {
|
||||
// ...
|
||||
'YOUR-PLUGIN-NAME': yourPlugin,
|
||||
};
|
||||
```
|
||||
|
||||
- if you need to change the front, create a file with the following template:
|
||||
|
||||
```typescript
|
||||
// file: front.ts
|
||||
export default (config: ConfigType<'YOUR-PLUGIN-NAME'>) => {
|
||||
// This function will be called as a preload script
|
||||
// So you can use front features like `document.querySelector`
|
||||
};
|
||||
```
|
||||
|
||||
then, register the plugin in `preload.ts`:
|
||||
|
||||
```typescript
|
||||
import yourPlugin from './plugins/YOUR-PLUGIN-NAME/front';
|
||||
|
||||
const rendererPlugins: PluginMapper<'renderer'> = {
|
||||
// ...
|
||||
'YOUR-PLUGIN-NAME': yourPlugin,
|
||||
};
|
||||
```
|
||||
|
||||
### Common use cases
|
||||
|
||||
- injecting custom CSS: create a `style.css` file in the same folder then:
|
||||
|
||||
Reference in New Issue
Block a user