1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-07-13 00:10:37 +02:00

Api: Added service to access resource external editing

This commit is contained in:
Laurent Cozic
2020-10-29 11:09:18 +00:00
parent 089d6a5c9e
commit d25fa796c0
2 changed files with 16 additions and 0 deletions

View File

@ -73,6 +73,20 @@ export default class ResourceEditWatcher {
return this.eventEmitter_.removeListener(eventName, callback);
}
externalApi() {
return {
openAndWatch: async ({ resourceId }:any) => {
return this.openAndWatch(resourceId);
},
stopWatching: async ({ resourceId }:any) => {
return this.stopWatching(resourceId);
},
isWatched: async ({ resourceId }:any) => {
return !!this.watchedItemByResourceId(resourceId);
},
};
}
private watch(fileToWatch:string) {
if (!this.chokidar_) return;