mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 20:38:52 +00:00
35 lines
730 B
TypeScript
35 lines
730 B
TypeScript
import { config, setupGlobal } from '@affine/env/config';
|
|
|
|
setupGlobal();
|
|
|
|
if (config.enablePlugin && !environment.isServer) {
|
|
import('@affine/copilot');
|
|
}
|
|
|
|
if (!environment.isServer) {
|
|
import('@affine/bookmark-block');
|
|
}
|
|
|
|
if (!environment.isDesktop && !environment.isServer) {
|
|
// Polyfill Electron
|
|
const unimplemented = () => {
|
|
throw new Error('AFFiNE Plugin Web will be supported in the future');
|
|
};
|
|
const affine = {
|
|
ipcRenderer: {
|
|
invoke: unimplemented,
|
|
send: unimplemented,
|
|
on: unimplemented,
|
|
once: unimplemented,
|
|
removeListener: unimplemented,
|
|
},
|
|
};
|
|
|
|
Object.freeze(affine);
|
|
|
|
Object.defineProperty(window, 'affine', {
|
|
value: affine,
|
|
writable: false,
|
|
});
|
|
}
|