ensure plugin loaded before calling any event

pull/5370/head
yann300 2 years ago
parent 7fc9da4ef4
commit 657d5ffb66
  1. 12
      libs/remixd/src/services/remixdClient.ts

@ -260,18 +260,24 @@ export class RemixdClient extends PluginClient {
this.emit('created', { path: utils.relativePath(f, this.currentSharedFolder), isReadOnly: false, isFolder: true })
})
*/
watcher.on('change', (f: string) => {
watcher.on('change', async (f: string) => {
if (this.trackDownStreamUpdate[f]) {
delete this.trackDownStreamUpdate[f]
return
}
if (this.isLoaded) {
this.emit('changed', utils.relativePath(f, this.currentSharedFolder))
}
})
watcher.on('unlink', (f: string) => {
watcher.on('unlink', async (f: string) => {
if (this.isLoaded) {
this.emit('removed', utils.relativePath(f, this.currentSharedFolder), false)
}
})
watcher.on('unlinkDir', (f: string) => {
watcher.on('unlinkDir', async (f: string) => {
if (this.isLoaded) {
this.emit('removed', utils.relativePath(f, this.currentSharedFolder), true)
}
})
}
}

Loading…
Cancel
Save