bitovi / launchpad

NodeJS Browser Launcher
MIT License
46 stars 28 forks source link

Promise-based API #79

Open stevenvachon opened 7 years ago

stevenvachon commented 7 years ago

Cleaner, specification-standard, and better supports async/await.

cdibbs commented 6 years ago

I agree. Promises would be a big improvement, given TypeScript, ES6, and such.

Look how clean it could be...

public async launch(opts: LaunchOptions): Promise<any> {
  try {
    const launcher = await launchpad.getLocalLauncher();
    const instance = await launcher.launch('http://localhost:1234', opts);
    // do things...
  } catch(ex) {
    // handle rejected promises from getLauncher or launch
  }
}