2020-10-13 13:57:03 +02:00
|
|
|
import Plugin from '../Plugin';
|
2020-11-13 19:09:28 +02:00
|
|
|
import { ContentScriptType, Script } from './types';
|
2020-10-13 13:57:03 +02:00
|
|
|
/**
|
|
|
|
* This class provides access to plugin-related features.
|
|
|
|
*/
|
|
|
|
export default class JoplinPlugins {
|
|
|
|
private plugin;
|
2020-11-23 19:06:52 +02:00
|
|
|
constructor(plugin: Plugin);
|
2020-10-13 13:57:03 +02:00
|
|
|
/**
|
|
|
|
* Registers a new plugin. This is the entry point when creating a plugin. You should pass a simple object with an `onStart` method to it.
|
|
|
|
* That `onStart` method will be executed as soon as the plugin is loaded.
|
|
|
|
*
|
|
|
|
* ```typescript
|
|
|
|
* joplin.plugins.register({
|
|
|
|
* onStart: async function() {
|
|
|
|
* // Run your plugin code here
|
|
|
|
* }
|
|
|
|
* });
|
|
|
|
* ```
|
|
|
|
*/
|
|
|
|
register(script: Script): Promise<void>;
|
2020-11-13 19:09:28 +02:00
|
|
|
/**
|
2021-01-12 01:34:06 +02:00
|
|
|
* @deprecated Use joplin.contentScripts.register()
|
2020-11-13 19:09:28 +02:00
|
|
|
*/
|
|
|
|
registerContentScript(type: ContentScriptType, id: string, scriptPath: string): Promise<void>;
|
2021-01-24 20:03:33 +02:00
|
|
|
/**
|
2021-01-27 14:48:47 +02:00
|
|
|
* Gets the plugin own data directory path. Use this to store any
|
|
|
|
* plugin-related data. Unlike [[installationDir]], any data stored here
|
|
|
|
* will be persisted.
|
2021-01-24 20:03:33 +02:00
|
|
|
*/
|
|
|
|
dataDir(): Promise<string>;
|
|
|
|
/**
|
2021-01-27 14:48:47 +02:00
|
|
|
* Gets the plugin installation directory. This can be used to access any
|
|
|
|
* asset that was packaged with the plugin. This directory should be
|
|
|
|
* considered read-only because any data you store here might be deleted or
|
|
|
|
* re-created at any time. To store new persistent data, use [[dataDir]].
|
|
|
|
*/
|
|
|
|
installationDir(): Promise<string>;
|
|
|
|
/**
|
|
|
|
* @deprecated Use joplin.require()
|
2021-01-24 20:03:33 +02:00
|
|
|
*/
|
|
|
|
require(_path: string): any;
|
2020-10-13 13:57:03 +02:00
|
|
|
}
|