非标
此特征是非标准的,且不在标准轨道中。不要在面向 Web 的生产站点中使用它:它不适用于每个用户。实现之间可能存在大的不兼容性,且行为将来可能改变。

SyncManager.register 方法在 SyncManager interface returns a Promise 解析为 SyncRegistration 实例。

句法

SyncManager.register([options]).then(function(syncRegistration) { ... })
					

返回

A Promise that resolves to an instance of SyncRegistration .

参数

选项 可选
An object that sets options for an instance of SyncRegistration . The available options are:
  • allowOnBattery : A boolean that determines whether synchronization is allowed when the user agent is on a battery-powered device. The default is true .
  • id : The unique identifier of the specified SyncRegistration 对象。
  • idleRequired : A boolean that determines whether synchronization is allowed when the user agent's device is idle. The default is false .
  • maxDelay : The maximum delay in milliseconds before the next sync event (or the first sync event if it is periodic). The default is 0 , meaning there is no maximum delay.
  • minDelay : The minimum delay in milliseconds before the next sync event (or the first sync event if it is periodic). The default is 0 .
  • minPeriod : The minimum time in milliseconds between periodic sync events. The default is 0 , meaning events are not periodic.
  • minRequiredNetwork : The network condition under which background synchronization will occur. Valid values are 'network-any' , 'network-offline' , 'network-online' , 'network-non-mobile' 。默认值为 'network-online' .

浏览器兼容性

The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
register 非标 Chrome 49 Edge 79 Firefox 不支持 No IE 不支持 No Opera 不支持 No Safari 不支持 No WebView Android 49 Chrome Android 49 Firefox Android 不支持 No Opera Android 不支持 No Safari iOS 不支持 No Samsung Internet Android 5.0

图例

完整支持

完整支持

不支持

不支持

实验。期望将来行为有所改变。

实验。期望将来行为有所改变。

非标。预期跨浏览器支持较差。

元数据

  • 最后修改: