1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-07-16 00:14:34 +02:00

Plugins: Adds joplin.workspace.onResourceChange

This commit is contained in:
Laurent Cozic
2021-12-30 11:25:39 +01:00
parent 59cdcaf8d1
commit 2660ff3af6
2 changed files with 22 additions and 2 deletions

View File

@ -38,8 +38,13 @@ interface SyncStartEvent {
withErrors: boolean;
}
interface ResourceChangeEvent {
id: string;
}
type ItemChangeHandler = (event: ItemChangeEvent)=> void;
type SyncStartHandler = (event: SyncStartEvent)=> void;
type ResourceChangeHandler = (event: ResourceChangeEvent)=> void;
/**
* The workspace service provides access to all the parts of Joplin that
@ -54,7 +59,7 @@ export default class JoplinWorkspace {
private store: any;
constructor(store: any) {
public constructor(store: any) {
this.store = store;
}
@ -98,6 +103,14 @@ export default class JoplinWorkspace {
return makeListener(eventManager, 'itemChange', wrapperHandler);
}
/**
* Called when a resource is changed. Currently this handled will not be
* called when a resource is added or deleted.
*/
public async onResourceChange(handler: ResourceChangeHandler): Promise<void> {
makeListener(eventManager, 'resourceChange', handler);
}
/**
* Called when an alarm associated with a to-do is triggered.
*/