Created
August 10, 2016 19:47
-
-
Save rpl/48cc87eb161a262f2e30632220e31eb6 to your computer and use it in GitHub Desktop.
use a flow type to pass config data through a Promise chain
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type RunConfig = { | |
runner: ExtensionRunner, | |
profile: FirefoxProfile, | |
client?: RemoteFirefox, | |
addonId?: string, | |
firefox?: FirefoxProcess, | |
}; | |
... | |
.then(({firefox, profile, client, addonId}: RunConfig) => { | |
if (!client) { | |
throw new Error('RemoteFirefox `client` should not be missing here'); | |
} | |
if (!addonId) { | |
throw new Error('addonId should not be missing here'); | |
} | |
if (!firefox) { | |
throw new Error('FirefoxProcess `firefox` should not be missing here'); | |
} | |
if (noReload) { | |
log.debug('Extension auto-reloading has been disabled'); | |
} else { | |
log.debug( | |
`Reloading extension when the source changes; id=${addonId}`); | |
reloadStrategy({ | |
firefox, profile, client, sourceDir, artifactsDir, addonId, | |
}); | |
} | |
return firefox; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment