Avoid binding expectOpenEvent into the closure

This commit is contained in:
Ash Wilson
2019-04-17 13:09:56 -04:00
parent 4f8de4bb0a
commit b591f83447

View File

@@ -407,16 +407,14 @@ class LaunchScenario {
const app = this.addApplication()
const windowPromises = []
for (const windowSpec of this.parseWindowSpecs(source)) {
const expectOpenEvent = windowSpec.roots.length > 0 || windowSpec.editors.length > 0
if (windowSpec.editors.length === 0) {
windowSpec.editors.push(null)
}
windowPromises.push((async (theApp, foldersToOpen, pathsToOpen) => {
const window = await theApp.openPaths({ newWindow: true, foldersToOpen, pathsToOpen })
if (expectOpenEvent) {
await emitterEventPromise(window, 'window:locations-opened')
if (foldersToOpen.length > 0 || pathsToOpen.filter(Boolean).length > 0) {
await emitterEventPromise(window, 'window:locations-opened', 15000, `preconditions('${source}')`)
}
return window
})(app, windowSpec.roots, windowSpec.editors))