ensure plugin loaded before calling any event

pull/2811/head^2
yann300 2 years ago
parent a178f6b4dd
commit aa6dbc994c
  1. 18
      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
}
this.emit('changed', utils.relativePath(f, this.currentSharedFolder))
if (this.isLoaded) {
this.emit('changed', utils.relativePath(f, this.currentSharedFolder))
}
})
watcher.on('unlink', (f: string) => {
this.emit('removed', utils.relativePath(f, this.currentSharedFolder), false)
watcher.on('unlink', async (f: string) => {
if (this.isLoaded) {
this.emit('removed', utils.relativePath(f, this.currentSharedFolder), false)
}
})
watcher.on('unlinkDir', (f: string) => {
this.emit('removed', utils.relativePath(f, this.currentSharedFolder), true)
watcher.on('unlinkDir', async (f: string) => {
if (this.isLoaded) {
this.emit('removed', utils.relativePath(f, this.currentSharedFolder), true)
}
})
}
}

Loading…
Cancel
Save