BudgetService

这是 实验性技术
检查 浏览器兼容性表格 在生产中使用这之前。

Obsolete
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.

BudgetService interface of the Web Budget API provides a programmatic interface to the user agent’s budget service. It is available in both document and worker environments.

特性

None.

方法

BudgetService.getCost()
返回 Promise that resolves to a double, indicating the worst-case background operation cost of the provided background operation.
BudgetService.getBudget()
返回 Promise that resolves to an array of BudgetState objects, indicating the expected state of the budget at times in the future.
BudgetService.reserve()
返回 Promise that resolves to a boolean, indicating whether the requested budget operation can be reserved.

浏览器兼容性

更新 GitHub 上的兼容性数据
Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
BudgetService
弃用 非标
Chrome 55 Edge ≤79 Firefox ? IE ? Opera 42 Safari ? WebView Android 55 Chrome Android 55 Firefox Android ? Opera Android 42 Safari iOS ? Samsung Internet Android 6.0
getBudget
弃用 非标
Chrome 55 Edge ≤79 Firefox ? IE ? Opera 42 Safari ? WebView Android 55 Chrome Android 55 Firefox Android ? Opera Android 42 Safari iOS ? Samsung Internet Android 6.0
getCost
弃用 非标
Chrome 55 Edge ≤79 Firefox ? IE ? Opera 42 Safari ? WebView Android 55 Chrome Android 55 Firefox Android ? Opera Android 42 Safari iOS ? Samsung Internet Android 6.0
reserve
弃用 非标
Chrome 55 Edge ≤79 Firefox ? IE ? Opera 42 Safari ? WebView Android 55 Chrome Android 55 Firefox Android ? Opera Android 42 Safari iOS ? Samsung Internet Android 6.0

图例

完整支持
完整支持
兼容性未知
兼容性未知
实验。期望将来行为有所改变。
实验。期望将来行为有所改变。
非标。预期跨浏览器支持较差。
弃用。不要用于新网站。
弃用。不要用于新网站。