-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add export auto infer for multi environment
- Loading branch information
1 parent
24ddb63
commit c3d5a77
Showing
17 changed files
with
141 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,18 @@ | ||
import { getWindowApiClient, getWorkerApiClient, type IFullAPI } from 'tauri-api-adapter' | ||
import { | ||
getWindowApiClient, | ||
getWorkerApiClient, | ||
isInIframe, | ||
isInWorker, | ||
isMain, | ||
type IFullAPI | ||
} from 'tauri-api-adapter' | ||
|
||
const client = getWorkerApiClient<IFullAPI>() | ||
|
||
client.clipboardReadText().then((text) => { | ||
console.log('Clipboard text from worker:', text) | ||
}) | ||
|
||
// self.postMessage | ||
|
||
// client.clipboardReadText().then((text) => { | ||
// console.log('Clipboard text from worker:', text) | ||
// }) | ||
console.log('worker isInIframe:', isInIframe) | ||
console.log('worker isInWorker:', isInWorker) | ||
console.log('worker isMain:', isMain) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,38 @@ | ||
<script lang="ts"> | ||
import { onMount } from 'svelte' | ||
import * as iframeApi from 'tauri-api-adapter/iframe' | ||
import * as nativeApi from 'tauri-api-adapter/native' | ||
import { defaultServerAPI, exposeApiToWindow, exposeApiToWorker, utils, isMain, isInIframe, isInWorker } from 'tauri-api-adapter' | ||
onMount(async () => { | ||
console.log('iframe Clipboard Text: ', await iframeApi.clipboard.readText()) | ||
// window.parent = { | ||
// postMessage: window.parent.postMessage | ||
// } | ||
// window.eval(` | ||
// window.parent = { | ||
// postMessage: window.parent.postMessage | ||
// } | ||
// `) | ||
setTimeout(async () => { | ||
iframeApi.clipboard.readText().then((text) => { | ||
console.log('iframe Clipboard Text: ', text) | ||
}) | ||
nativeApi.clipboard.readText().then((text) => { | ||
console.log('native API Clipboard Text: ', text) | ||
}) | ||
console.log( | ||
'hack with __TAURI_INTERNALS__', | ||
await window.parent.__TAURI_INTERNALS__.invoke('plugin:clipboard|read_text') | ||
) | ||
}, 1000) | ||
}) | ||
</script> | ||
|
||
<div class="container p-5"> | ||
<h1 class="text-3xl font-bold underline">iframe</h1> | ||
<h2>isMain: {isMain}</h2> | ||
<h2>isInIframe: {isInIframe}</h2> | ||
<h2>isInWorker: {isInWorker}</h2> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,17 @@ | ||
export * from '@/comlink' | ||
export { defaultClientAPI } from '@/client' | ||
export { defaultClientAPI, hasWindow, isInWorker, isInIframe, isMain } from '@/client' | ||
export { defaultServerAPI } from '@/server' | ||
export * from '@/api/server-types' | ||
export * from '@/api/client-types' | ||
export * as utils from './utils' | ||
export * as nativeApi from '@/native' | ||
export * as workerApi from '@/worker' | ||
|
||
export { clipboard } from '@/api/clipboard' | ||
export { dialog } from '@/api/dialog' | ||
export { fs } from '@/api/fs' | ||
export { network } from '@/api/network' | ||
export { notification } from '@/api/notification' | ||
export { os } from '@/api/os' | ||
export { shell } from '@/api/shell' | ||
export { sysInfo } from '@/api/system-info' | ||
export { fetch } from '@/api/fetch' | ||
export { listen, TauriEvent, comlinkEvent as event } from '@/api/event' | ||
export * from '@/worker' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters