1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-02-01 19:15:01 +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;

View File

@ -1,7 +1,9 @@
import ResourceEditWatcher from 'lib/services/ResourceEditWatcher/index';
const ExternalEditWatcher = require('lib/services/ExternalEditWatcher');
export default {
externalEditWatcher: () => ExternalEditWatcher.instance().externalApi(),
resourceEditWatcher: () => ResourceEditWatcher.instance().externalApi(),
};