1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-27 10:32:58 +02:00
joplin/packages/app-mobile/plugins/PluginRunner/backgroundPage/initializePluginBackgroundIframe.ts
Henry Heino 55cafb8891
Android: Add support for Markdown editor plugins (#10086)
Co-authored-by: Laurent Cozic <laurent22@users.noreply.github.com>
2024-03-11 15:02:15 +00:00

19 lines
730 B
TypeScript

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();
(window as any).joplin = messenger.remoteApi.api.joplin;
reportUnhandledErrors(messenger.remoteApi.onError);
wrapConsoleLog(messenger.remoteApi.onLog);
};
export default initializePluginBackgroundIframe;