1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-08-24 20:19:10 +02:00

Compare commits

...

1 Commits

Author SHA1 Message Date
Laurent Cozic
0680c47b05 Adding service for ResourceEditWatcher 2020-10-29 11:01:48 +00:00
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(),
};