mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-06-06 13:53:54 +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:
@@ -10,11 +10,11 @@ repository = { workspace = true }
|
||||
links = "tauri-plugin-global-shortcut"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
rustc-args = [ "--cfg", "docsrs" ]
|
||||
rustdoc-args = [ "--cfg", "docsrs" ]
|
||||
rustc-args = ["--cfg", "docsrs"]
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
|
||||
[build-dependencies]
|
||||
tauri-plugin = { workspace = true, features = [ "build" ] }
|
||||
tauri-plugin = { workspace = true, features = ["build"] }
|
||||
|
||||
[dependencies]
|
||||
serde = { workspace = true }
|
||||
|
||||
@@ -87,12 +87,12 @@ fn main() {
|
||||
Afterwards all the plugin's APIs are available through the JavaScript bindings:
|
||||
|
||||
```javascript
|
||||
import { register } from "@tauri-apps/plugin-global-shortcut";
|
||||
await register("CommandOrControl+Shift+C", (event) => {
|
||||
if (event.state === "Pressed") {
|
||||
console.log("Shortcut triggered");
|
||||
import { register } from '@tauri-apps/plugin-global-shortcut'
|
||||
await register('CommandOrControl+Shift+C', (event) => {
|
||||
if (event.state === 'Pressed') {
|
||||
console.log('Shortcut triggered')
|
||||
}
|
||||
});
|
||||
})
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
@@ -20,4 +20,4 @@ We prefer to receive reports in English.
|
||||
|
||||
Please disclose a vulnerability or security relevant issue here: [https://github.com/tauri-apps/plugins-workspace/security/advisories/new](https://github.com/tauri-apps/plugins-workspace/security/advisories/new).
|
||||
|
||||
Alternatively, you can also contact us by email via [security@tauri.app](mailto:security@tauri.app).
|
||||
Alternatively, you can also contact us by email via [security@tauri.app](mailto:security@tauri.app).
|
||||
|
||||
@@ -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 }
|
||||
|
||||
@@ -2,6 +2,6 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import { createConfig } from "../../shared/rollup.config.js";
|
||||
import { createConfig } from '../../shared/rollup.config.js'
|
||||
|
||||
export default createConfig();
|
||||
export default createConfig()
|
||||
|
||||
Reference in New Issue
Block a user