mirror of
https://github.com/0PandaDEV/Qopy.git
synced 2025-06-16 20:07:33 +02:00
chore: system
This commit is contained in:
parent
aa928f7094
commit
97c023df91
78 changed files with 15225 additions and 15225 deletions
|
@ -1,27 +1,27 @@
|
|||
import { platform } from "@tauri-apps/plugin-os";
|
||||
import { useKeyboard, Key } from "@waradu/keyboard";
|
||||
|
||||
export default defineNuxtPlugin(async (nuxtApp) => {
|
||||
const keyboardInstance = useKeyboard();
|
||||
let currentOS = "windows";
|
||||
try {
|
||||
const osName = await Promise.resolve(platform());
|
||||
currentOS = osName.toLowerCase().includes("mac") ? "macos" : "windows";
|
||||
} catch (error) {
|
||||
console.error("Error detecting platform:", error);
|
||||
}
|
||||
|
||||
// Defer initialization until the app is mounted
|
||||
nuxtApp.hook('app:mounted', () => {
|
||||
keyboardInstance.init();
|
||||
});
|
||||
|
||||
nuxtApp.provide('keyboard', {
|
||||
listen: keyboardInstance.listen.bind(keyboardInstance),
|
||||
init: keyboardInstance.init.bind(keyboardInstance),
|
||||
Key,
|
||||
currentOS,
|
||||
// Provide a clear method if users need to manually clear all listeners from the instance
|
||||
clearAll: keyboardInstance.clear ? keyboardInstance.clear.bind(keyboardInstance) : () => { console.warn('@waradu/keyboard instance does not have a clear method'); }
|
||||
});
|
||||
});
|
||||
import { platform } from "@tauri-apps/plugin-os";
|
||||
import { useKeyboard, Key } from "@waradu/keyboard";
|
||||
|
||||
export default defineNuxtPlugin(async (nuxtApp) => {
|
||||
const keyboardInstance = useKeyboard();
|
||||
let currentOS = "windows";
|
||||
try {
|
||||
const osName = await Promise.resolve(platform());
|
||||
currentOS = osName.toLowerCase().includes("mac") ? "macos" : "windows";
|
||||
} catch (error) {
|
||||
console.error("Error detecting platform:", error);
|
||||
}
|
||||
|
||||
// Defer initialization until the app is mounted
|
||||
nuxtApp.hook('app:mounted', () => {
|
||||
keyboardInstance.init();
|
||||
});
|
||||
|
||||
nuxtApp.provide('keyboard', {
|
||||
listen: keyboardInstance.listen.bind(keyboardInstance),
|
||||
init: keyboardInstance.init.bind(keyboardInstance),
|
||||
Key,
|
||||
currentOS,
|
||||
// Provide a clear method if users need to manually clear all listeners from the instance
|
||||
clearAll: keyboardInstance.clear ? keyboardInstance.clear.bind(keyboardInstance) : () => { console.warn('@waradu/keyboard instance does not have a clear method'); }
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue