import { LogMessageCallback, PluginData } from '../../types'; import CodeMirrorControl from '../CodeMirrorControl'; import codeMirrorRequire from './codeMirrorRequire'; let pluginScriptIdCounter = 0; let pluginLoaderCounter = 0; type OnScriptLoadCallback = (exports: any)=> void; type OnPluginRemovedCallback = ()=> void; export default class PluginLoader { private pluginScriptsContainer: HTMLElement; private loadedPluginIds: string[] = []; private pluginRemovalCallbacks: Record = {}; private pluginLoaderId: number; public constructor(private editor: CodeMirrorControl, private logMessage: LogMessageCallback) { this.pluginScriptsContainer = document.createElement('div'); this.pluginScriptsContainer.style.display = 'none'; // For testing this.pluginScriptsContainer.id = 'joplin-plugin-scripts-container'; document.body.appendChild(this.pluginScriptsContainer); // addPlugin works by creating