diff --git a/WebIDL.md b/WebIDL.md new file mode 100644 index 0000000..3c51154 --- /dev/null +++ b/WebIDL.md @@ -0,0 +1,39 @@ +# Proposed WebIDL + +## Definition of the interface +```webidl +partial interface ServiceWorkerRegistration { + readonly attribute PeriodicSyncManager periodicSync; +}; + +[SecureContext, Exposed=(Window,Worker)] +interface PeriodicSyncManager { + Promise register(DOMString tag, BackgroundSyncOptions options); + Promise unregister(DOMString tag); + Promise> getTags(); +}; +``` + +## Definition of the Service Worker event +```webidl +partial interface ServiceWorkerGlobalScope { + attribute EventHandler onperiodicsync; +}; + +[Constructor(DOMString type, PeriodicSyncEventInit init), Exposed=ServiceWorker] +interface SyncEvent : ExtendableEvent { + readonly attribute DOMString tag; +}; + +dictionary PeriodicSyncEventInit : ExtendableEventInit { + required DOMString tag; +}; +``` + +## Extensions to the Background Sync API +```webidl +dictionary BackgroundSyncOptions { + // …existing properties… + unsigned long long minInterval; +}; +```