Re: [mediacapture-region] What makes CropTarget special to require an asynchronous creation? (#17)

Gentlemen, I have a simple proposal.
```webidl
  Promise<void> cropTo(Element);
  Promise<void> cropTo(CropTarget);
```

1. Same document:
```js
  // Note that *only* cropTo() is async here, which is
  // within consensus.
  await track.cropTo(document.getElementById('id'));
```

2. Multiple documents:
```js
  function totallySyncFunction() {
    setTimeout(async () => {
      await getCropTargetAndSendItToCapturer(element);
    }, 0);
  }

  async function getCropTargetAndSendItToCapturer(element) {
    await CropTarget.fromElement(element);
    otherDocument.postMessage(...);
  }
```

Note that, because **receiving** the message is asynchronous, the receiver would not observe a difference. This seems completely palatable for a generally synchronous sender.

Wdyt?



-- 
GitHub Notification of comment by eladalon1983
Please view or discuss this issue at https://github.com/w3c/mediacapture-region/issues/17#issuecomment-1132746253 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Friday, 20 May 2022 10:33:26 UTC