Add prettier. Format.

This commit is contained in:
2026-07-22 02:12:05 +00:00
parent d28b09dc21
commit 18baa96848
45 changed files with 4520 additions and 2613 deletions

View File

@@ -1,39 +1,48 @@
import type { NativePlatformAdapter, NativeRouterRuntime } from '@native-vue-router/core'
import type {
NativePlatformAdapter,
NativeRouterRuntime,
} from "@native-vue-router/core";
export interface ElectronCommandLine {
appendSwitch(name: string, value?: string): void
appendSwitch(name: string, value?: string): void;
}
export function disableElectronHistoryGestures(commandLine: ElectronCommandLine) {
commandLine.appendSwitch('disable-features', 'OverscrollHistoryNavigation')
export function disableElectronHistoryGestures(
commandLine: ElectronCommandLine,
) {
commandLine.appendSwitch("disable-features", "OverscrollHistoryNavigation");
}
declare global {
interface Window {
nativeVueHost?: {
onBack(callback: () => void): () => void
onForward?(callback: () => void): () => void
onMemoryPressure?(callback: () => void): () => void
}
onBack(callback: () => void): () => void;
onForward?(callback: () => void): () => void;
onMemoryPressure?(callback: () => void): () => void;
};
}
}
export function createElectronRendererAdapter(): NativePlatformAdapter {
return {
name: 'electron',
name: "electron",
install(runtime: NativeRouterRuntime) {
const removeBack = window.nativeVueHost?.onBack(() => {
if (runtime.canGoBack.value) void runtime.pop()
})
const removeForward = window.nativeVueHost?.onForward?.(() => runtime.router.forward())
const removeMemoryPressure = window.nativeVueHost?.onMemoryPressure?.(() => {
runtime.trimCache({ reason: 'memory-pressure' })
})
if (runtime.canGoBack.value) void runtime.pop();
});
const removeForward = window.nativeVueHost?.onForward?.(() =>
runtime.router.forward(),
);
const removeMemoryPressure = window.nativeVueHost?.onMemoryPressure?.(
() => {
runtime.trimCache({ reason: "memory-pressure" });
},
);
return () => {
removeBack?.()
removeForward?.()
removeMemoryPressure?.()
}
removeBack?.();
removeForward?.();
removeMemoryPressure?.();
};
},
}
};
}