mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-08-19 19:17:15 +02:00
chore: adjust prettier config, .gitignore and use taplo to format toml files (#1728)
* chore: adjust prettier config, .gitignore and use taplo to format toml files This brings the plugins-workspace repository to the same code style of the main tauri repo * format toml * ignore examples gen dir * add .vscode/extensions.json * remove packageManager field * fmt * fix audit * taplo ignore permissions autogenerated files * remove create dummy dist * fix prettier workflow * install fmt in prettier workflow --------- Co-authored-by: Lucas Nogueira <lucas@tauri.app>
This commit is contained in:
co-authored by
Lucas Nogueira
parent
72c2ce82c1
commit
cf4d7d4e6c
@@ -8,15 +8,15 @@
|
||||
* @module
|
||||
*/
|
||||
|
||||
import { invoke, Channel } from "@tauri-apps/api/core";
|
||||
import { invoke, Channel } from '@tauri-apps/api/core'
|
||||
|
||||
export interface ShortcutEvent {
|
||||
shortcut: string;
|
||||
id: number;
|
||||
state: "Released" | "Pressed";
|
||||
shortcut: string
|
||||
id: number
|
||||
state: 'Released' | 'Pressed'
|
||||
}
|
||||
|
||||
export type ShortcutHandler = (event: ShortcutEvent) => void;
|
||||
export type ShortcutHandler = (event: ShortcutEvent) => void
|
||||
|
||||
/**
|
||||
* Register a global shortcut or a list of shortcuts.
|
||||
@@ -50,15 +50,15 @@ export type ShortcutHandler = (event: ShortcutEvent) => void;
|
||||
*/
|
||||
async function register(
|
||||
shortcuts: string | string[],
|
||||
handler: ShortcutHandler,
|
||||
handler: ShortcutHandler
|
||||
): Promise<void> {
|
||||
const h = new Channel<ShortcutEvent>();
|
||||
h.onmessage = handler;
|
||||
const h = new Channel<ShortcutEvent>()
|
||||
h.onmessage = handler
|
||||
|
||||
return await invoke("plugin:global-shortcut|register", {
|
||||
return await invoke('plugin:global-shortcut|register', {
|
||||
shortcuts: Array.isArray(shortcuts) ? shortcuts : [shortcuts],
|
||||
handler: h,
|
||||
});
|
||||
handler: h
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -80,9 +80,9 @@ async function register(
|
||||
* @since 2.0.0
|
||||
*/
|
||||
async function unregister(shortcuts: string | string[]): Promise<void> {
|
||||
return await invoke("plugin:global-shortcut|unregister", {
|
||||
shortcuts: Array.isArray(shortcuts) ? shortcuts : [shortcuts],
|
||||
});
|
||||
return await invoke('plugin:global-shortcut|unregister', {
|
||||
shortcuts: Array.isArray(shortcuts) ? shortcuts : [shortcuts]
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -96,7 +96,7 @@ async function unregister(shortcuts: string | string[]): Promise<void> {
|
||||
* @since 2.0.0
|
||||
*/
|
||||
async function unregisterAll(): Promise<void> {
|
||||
return await invoke("plugin:global-shortcut|unregister_all", {});
|
||||
return await invoke('plugin:global-shortcut|unregister_all', {})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -115,9 +115,9 @@ async function unregisterAll(): Promise<void> {
|
||||
* @since 2.0.0
|
||||
*/
|
||||
async function isRegistered(shortcut: string): Promise<boolean> {
|
||||
return await invoke("plugin:global-shortcut|is_registered", {
|
||||
shortcut,
|
||||
});
|
||||
return await invoke('plugin:global-shortcut|is_registered', {
|
||||
shortcut
|
||||
})
|
||||
}
|
||||
|
||||
export { register, unregister, unregisterAll, isRegistered };
|
||||
export { register, unregister, unregisterAll, isRegistered }
|
||||
|
||||
Reference in New Issue
Block a user