getAvailability - Web APIs 编辑

When the getAvailability() method is called, the user agent MUST run the following steps:

Input
presentationUrls, a list of presentation request URLs
Output
P, a Promise
  1. If one of the following conditions is true:Run the following substeps:
    1. Return a Promise rejected with a SecurityError.
    2. Abort these steps.
  2. Let P be a new Promise.
  3. Return P, but continue running these steps in parallel.
  4. If the user agent is unable to monitor the list of available presentation displays for the entire duration of the controlling browsing context (e.g., because the user has disabled this feature), then:
    1. Resolve P with a new PresentationAvailability object with its value property set to false.
    2. Abort all the remaining steps.
  5. If the user agent is unable to continuously monitor the list of available presentation displays but can find presentation displays in order to start a connection, then:
    1. Reject P with a NotSupportedError exception.
    2. Abort all the remaining steps.
  6. If there exists a tuple (A, presentationUrls) in the set of availability objects, then:
    1. Resolve P with A.
    2. Abort all the remaining steps.
  7. Let A be a new PresentationAvailability object with its value property set as follows:
    1. false if the list of available presentation displays is empty.
    2. true if there is at least one compatible presentation display for some member of presentationUrls. Meaning there is an entry (presentationUrl, display) in the list of available presentation displays for some presentationUrl in presentationUrls.
    3. false otherwise.
  8. Create a tuple (A, presentationUrls) and add it to the set of availability objects.
  9. Run the algorithm to monitor the list of available presentation displays.
  10. Resolve P with A.

Browser compatibility

BCD tables only load in the browser

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:33 次

字数:4880

最后编辑:7 年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文