大网数据广告活动
Web 标准与前端开发

PresentationRequest: getAvailability() method

· 52CE 我爱测

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

Presentation API

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

  1. If one of the following conditions is true:

    Run the following substeps:

    1. Return a Promise rejected with a SecurityError DOMException.
    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 DOMException.
    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.

Specifications

Browser compatibility

来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。

资料来源与适用范围

资料来源
MDN Web Docs / Mozilla 贡献者
适用范围
请按文中版本与环境说明核对
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 2.5

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。