mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-11-27 04:31:58 +03:00
feat: use ipc provider when client app's preload script inject the global flag.
This commit is contained in:
parent
c83537aac6
commit
b9c0669a15
@ -7,6 +7,7 @@ import { getApis, Apis } from './apis/index.js';
|
||||
import { AffineProvider, BaseProvider } from './provider/index.js';
|
||||
import { LocalProvider } from './provider/index.js';
|
||||
import { getKVConfigure } from './store.js';
|
||||
import { TauriIPCProvider } from './provider/tauri-ipc/index.js';
|
||||
|
||||
// load workspace's config
|
||||
type LoadConfig = {
|
||||
@ -43,6 +44,10 @@ export class DataCenter {
|
||||
const dc = new DataCenter(debug);
|
||||
dc.addProvider(AffineProvider);
|
||||
dc.addProvider(LocalProvider);
|
||||
// use ipc provider when client app's preload script inject the global flag.
|
||||
if (typeof window !== 'undefined' && window.CLIENT_APP) {
|
||||
dc.addProvider(TauriIPCProvider);
|
||||
}
|
||||
|
||||
return dc;
|
||||
}
|
||||
|
8
packages/data-center/src/types.ts
Normal file
8
packages/data-center/src/types.ts
Normal file
@ -0,0 +1,8 @@
|
||||
declare global {
|
||||
interface Window {
|
||||
CLIENT_APP?: boolean;
|
||||
__editoVersion?: string;
|
||||
}
|
||||
}
|
||||
|
||||
export {};
|
Loading…
Reference in New Issue
Block a user