mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 12:55:00 +00:00
feat: init window.affine (#2682)
(cherry picked from commit 8f6db00402)
This commit is contained in:
@@ -9,3 +9,26 @@ if (config.enablePlugin && !environment.isServer) {
|
||||
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,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user