You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-07-16 00:14:34 +02:00
Chore: Refactor mobile plugin logic into locations more consistent with other parts of the app (#10636)
This commit is contained in:
@ -0,0 +1,19 @@
|
||||
import WindowMessenger from '@joplin/lib/utils/ipc/WindowMessenger';
|
||||
import { PluginMainProcessApi, PluginWebViewApi } from '../types';
|
||||
import reportUnhandledErrors from './utils/reportUnhandledErrors';
|
||||
import wrapConsoleLog from './utils/wrapConsoleLog';
|
||||
|
||||
|
||||
export const initializePluginBackgroundIframe = async (messageChannelId: string) => {
|
||||
const localApi = { };
|
||||
const messenger = new WindowMessenger<PluginWebViewApi, PluginMainProcessApi>(messageChannelId, parent, localApi);
|
||||
await messenger.awaitRemoteReady();
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
|
||||
(window as any).joplin = messenger.remoteApi.api.joplin;
|
||||
|
||||
reportUnhandledErrors(messenger.remoteApi.onError);
|
||||
wrapConsoleLog(messenger.remoteApi.onLog);
|
||||
};
|
||||
|
||||
export default initializePluginBackgroundIframe;
|
Reference in New Issue
Block a user