PeriodicSyncManager: unregister() method

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

Note: This feature is available in Web Workers.

Phương thức unregister() của giao diện PeriodicSyncManager hủy đăng ký yêu cầu đồng bộ hóa định kỳ tương ứng với tag được chỉ định và trả về Promise phân giải khi hủy đăng ký hoàn tất.

Cú pháp

js
unregister(tag)

Tham số

tag

Định danh String duy nhất mô tả đồng bộ hóa nền cụ thể.

Giá trị trả về

Trả về Promise phân giải với undefined.

Ngoại lệ

Không có.

Ví dụ

Ví dụ sau xóa một đồng bộ hóa định kỳ để ngừng đồng bộ các bài viết trong nền.

js
navigator.serviceWorker.ready.then((registration) => {
  registration.periodicSync.unregister("get-latest-news");
});

Thông số kỹ thuật

Specification
Web Periodic Background Synchronization
# dom-periodicsyncmanager-unregister

Tương thích trình duyệt

Xem thêm