Skip to content

Commit

Permalink
Add interfaces/periodic-background-sync.idl and update test (web-plat…
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenmcgruer authored May 5, 2020
1 parent f9709ad commit 7c823f6
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 31 deletions.
35 changes: 35 additions & 0 deletions interfaces/periodic-background-sync.idl
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// GENERATED CONTENT - DO NOT EDIT
// Content was automatically extracted by Reffy into reffy-reports
// (https://github.com/tidoust/reffy-reports)
// Source: Web Periodic Background Synchronization (https://wicg.github.io/periodic-background-sync/)

partial interface ServiceWorkerGlobalScope {
attribute EventHandler onperiodicsync;
};

[Exposed=(Window,Worker)]
partial interface ServiceWorkerRegistration {
readonly attribute PeriodicSyncManager periodicSync;
};

[Exposed=(Window,Worker)]
interface PeriodicSyncManager {
Promise<void> register(DOMString tag, optional BackgroundSyncOptions options);
Promise<sequence<DOMString>> getTags();
Promise<void> unregister(DOMString tag);
};

dictionary BackgroundSyncOptions {
[EnforceRange] unsigned long long minInterval = 0;
};

dictionary PeriodicSyncEventInit : ExtendableEventInit {
required DOMString tag;
};

[
Constructor(DOMString type, PeriodicSyncEventInit init),
Exposed=ServiceWorker
] interface PeriodicSyncEvent : ExtendableEvent {
readonly attribute DOMString tag;
};
44 changes: 13 additions & 31 deletions periodic-background-sync/idlharness.https.any.js
Original file line number Diff line number Diff line change
@@ -1,38 +1,20 @@
// META: script=/resources/WebIDLParser.js
// META: script=/resources/idlharness.js
// META: timeout=long

'use strict';

// https://wicg.github.io/periodic-background-sync/

const idl = `
partial interface ServiceWorkerGlobalScope {
attribute EventHandler onperiodicsync;
};
[
Exposed=(Window,Worker)
] partial interface ServiceWorkerRegistration {
readonly attribute PeriodicSyncManager periodicSync;
readonly attribute SyncManager sync;
};
dictionary PeriodicSyncEventInit : ExtendableEventInit {
required DOMString tag;
};
[
Constructor(DOMString type, PeriodicSyncEventInit init),
Exposed=ServiceWorker
] interface PeriodicSyncEvent : ExtendableEvent {
readonly attribute DOMString tag;
};
`;

test(t => {
const idlArray = new IdlArray();
idlArray.add_idls(idl);
idlArray.add_objects({
ServiceWorkerGlobalScope: ['self', 'onperiodicsync'],
ServiceWorkerRegistration: ['registration'],
PeriodicSyncManager: ['registration.periodicSync'],
PeriodicSyncEvent: ['new PeriodicSyncEvent("tag")'],
});
}, 'IDL test for Periodic Background Sync');
idl_test(
['periodic-background-sync'],
['service-workers', 'html', 'dom'],
async idl_array => {
idl_array.add_objects({
ServiceWorkerGlobalScope: ['self', 'onperiodicsync'],
ServiceWorkerRegistration: ['registration'],
PeriodicSyncManager: ['registration.periodicSync'],
PeriodicSyncEvent: ['new PeriodicSyncEvent("tag")'],
});
}
);

0 comments on commit 7c823f6

Please sign in to comment.