mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-05-31 13:39:36 +02:00
faa89850d0
* chore(deps): replace dependency eslint-config-standard-with-typescript with eslint-config-love 43.1.0 * actually apply the rules lol * rebuild --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: FabianLars <fabianlars@fabianlars.de>
26 lines
741 B
TypeScript
26 lines
741 B
TypeScript
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
import { invoke } from "@tauri-apps/api/core";
|
|
import { type UnlistenFn, listen } from "@tauri-apps/api/event";
|
|
|
|
export async function getCurrent(): Promise<string[] | null> {
|
|
return await invoke<string[] | null>("plugin:deep-link|get_current");
|
|
|
|
// return await invoke("plugin:deep-link|get_current");
|
|
}
|
|
|
|
export async function onOpenUrl(
|
|
handler: (urls: string[]) => void,
|
|
): Promise<UnlistenFn> {
|
|
const current = await getCurrent();
|
|
if (current != null) {
|
|
handler(current);
|
|
}
|
|
|
|
return await listen<string[]>("deep-link://new-url", (event) => {
|
|
handler(event.payload);
|
|
});
|
|
}
|