pull/504/head
FabianLars 2 years ago
parent 31f3385065
commit 7f1a9bbf87
No known key found for this signature in database
GPG Key ID: 838F329885A9C43D

@ -5,4 +5,5 @@ dist-js
pnpm-lock.yaml pnpm-lock.yaml
Cargo.lock Cargo.lock
.build .build
build
api-iife.js api-iife.js

@ -1,4 +1,4 @@
<!DOCTYPE html> <!doctype html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />

@ -19,7 +19,7 @@ http
function (_error, content) { function (_error, content) {
response.writeHead(200); response.writeHead(200);
response.end(content, "utf-8"); response.end(content, "utf-8");
} },
); );
} else { } else {
response.writeHead(404); response.writeHead(404);

@ -2,7 +2,10 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
import { onOpenUrl, getCurrent as getCurrentDeepLinkUrls } from "@tauri-apps/plugin-deep-link"; import {
onOpenUrl,
getCurrent as getCurrentDeepLinkUrls,
} from "@tauri-apps/plugin-deep-link";
function handler(urls: string[]) { function handler(urls: string[]) {
console.log(urls); console.log(urls);

@ -6,16 +6,20 @@ import { invoke } from "@tauri-apps/api/tauri";
import { UnlistenFn, listen } from "@tauri-apps/api/event"; import { UnlistenFn, listen } from "@tauri-apps/api/event";
export async function getCurrent(): Promise<string[] | null> { export async function getCurrent(): Promise<string[] | null> {
return await invoke<string[] | null>("plugin:deep-link|get_current") return await invoke<string[] | null>("plugin:deep-link|get_current");
// return await invoke("plugin:deep-link|get_current"); // return await invoke("plugin:deep-link|get_current");
} }
export async function onOpenUrl(handler: (urls: string[]) => void): Promise<UnlistenFn> { export async function onOpenUrl(
const current = await getCurrent() handler: (urls: string[]) => void,
): Promise<UnlistenFn> {
const current = await getCurrent();
if (current != null) { if (current != null) {
handler(current) handler(current);
} }
return await listen<string[]>("deep-link://new-url", (event) => handler(event.payload)) return await listen<string[]>("deep-link://new-url", (event) =>
handler(event.payload),
);
} }

@ -5,7 +5,7 @@ import { createConfig } from "../../shared/rollup.config.mjs";
export default createConfig({ export default createConfig({
input: "guest-js/index.ts", input: "guest-js/index.ts",
pkg: JSON.parse( pkg: JSON.parse(
readFileSync(new URL("./package.json", import.meta.url), "utf8") readFileSync(new URL("./package.json", import.meta.url), "utf8"),
), ),
external: [/^@tauri-apps\/api/], external: [/^@tauri-apps\/api/],
}); });

@ -1,2 +1,6 @@
export const prerender = true // Copyright 2019-2023 Tauri Programme within The Commons Conservancy
export const ssr = false // SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
export const prerender = true;
export const ssr = false;

@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
import adapter from '@sveltejs/adapter-static' import adapter from "@sveltejs/adapter-static";
import { vitePreprocess } from "@sveltejs/kit/vite"; import { vitePreprocess } from "@sveltejs/kit/vite";
/** @type {import('@sveltejs/kit').Config} */ /** @type {import('@sveltejs/kit').Config} */

Loading…
Cancel
Save