async function run(target, cmd) {
  const id = `result${counter++}`;
  target.postMessage({run: {cmd, id}}, '*');
  return new Promise(resolve => void window.addEventListener('message', function listen({data}) {
    if (!(id in data)) return;
    window.removeEventListener('message', listen);
    resolve(data[id]);
  }));
}
@param {Window} target
@param {string} cmd