Add `Promise` version of events
This pr extends the generator script to add Promise versions of events, e.g.:
domContentEventFired(): Promise<Protocol.Page.DomContentEventFiredEvent>;
as a complement for
on(event: 'domContentEventFired', listener: (params: Protocol.Page.DomContentEventFiredEvent) => void): void;
The motivation for this pr is to provide typings support for the following syntax:
const {Page} = client;
await Page.domContentEventFired();
Currently, typings support is provided for the following syntax via DefinitelyTyped's chrome-remote-interface typings:
await client['Page.domContentEventFired']();
but it is less elegant and the client part shouldn't really be necessary. Unfortunately, it doesn't seem possible to provide typings for the former syntax via protocol-mapping.d.ts since it is not possible to split something like 'Page.domContentEventFired' into its component parts with the current version of TypeScript (4.3).
In the code, there are two forEach loops for emitApiEvent() so that all the on() overloads are kept together.
Fixes #246.