INNER CODE UNIT · TypeScript

getCurrentDeepLinks

openakita/openakita · apps/setup-center/src/platform/index.ts:62

export async function getCurrentDeepLinks(): Promise<string[]> {
  if (IS_CAPACITOR) {
    const { App } = await import('@capacitor/app');
    const result = await App.getLaunchUrl();
    return result?.url ? [result.url] : [];
  }
  if (!IS_TAURI) return [];
  const { getCurrent } = await import("@tauri-apps/plugin-deep-link");
  return (await getCurrent()) ?? [];
}

export async function onDeepLinkOpen(handler: (urls: string[]) => void): Promise<() => void> {
  if (IS_CAPACITOR) {
    const { App } = await import('@capacitor/app');
    const listener = await App.addListener('appUrlOpen', ({ url }) => handler([url]));
    return () => { void listener.remove(); };
  }
  if (!IS_TAURI) return () => {};

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…