forked from dart-lang/web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbackground_sync.dart
91 lines (80 loc) · 3.06 KB
/
background_sync.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
//
// API docs from [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web).
// Attributions and copyright licensing by Mozilla Contributors is licensed
// under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/.
// Generated from Web IDL definitions.
// ignore_for_file: unintended_html_in_doc_comment
@JS()
library;
import 'dart:js_interop';
import 'service_workers.dart';
/// The **`SyncManager`** interface of the [Background Synchronization API]
/// provides an interface for registering and listing sync registrations.
///
/// ---
///
/// API documentation sourced from
/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/SyncManager).
extension type SyncManager._(JSObject _) implements JSObject {
/// The **`register()`** method of the [SyncManager] interface registers a
/// synchronization event, triggering a [ServiceWorkerGlobalScope.sync_event]
/// event inside the associated service worker as soon as network connectivity
/// is available.
external JSPromise<JSAny?> register(String tag);
/// The **`getTags()`** method of the
/// [SyncManager] interface returns a list of developer-defined identifiers
/// for
/// `SyncManager` registrations.
external JSPromise<JSArray<JSString>> getTags();
}
/// @AvailableInWorkers("service")
///
/// The **`SyncEvent`** interface of the [Background Synchronization API]
/// represents a sync action that is dispatched on the
/// [ServiceWorkerGlobalScope] of a ServiceWorker.
///
/// This interface inherits from the [ExtendableEvent] interface.
///
/// ---
///
/// API documentation sourced from
/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/SyncEvent).
extension type SyncEvent._(JSObject _) implements ExtendableEvent, JSObject {
external factory SyncEvent(
String type,
SyncEventInit init,
);
/// @AvailableInWorkers("service")
///
/// The **`tag`** read-only property of the
/// [SyncEvent] interface returns the developer-defined identifier for
/// this `SyncEvent`. This is the value passed in the `tag` parameter
/// of the [SyncEvent.SyncEvent] constructor.
external String get tag;
/// @AvailableInWorkers("service")
///
/// The **`lastChance`** read-only property of the
/// [SyncEvent] interface returns `true` if the user agent will not
/// make further synchronization attempts after the current attempt. This is
/// the value
/// passed in the `lastChance` parameter of the
/// [SyncEvent.SyncEvent] constructor.
external bool get lastChance;
}
extension type SyncEventInit._(JSObject _)
implements ExtendableEventInit, JSObject {
external factory SyncEventInit({
bool bubbles,
bool cancelable,
bool composed,
required String tag,
bool lastChance,
});
external String get tag;
external set tag(String value);
external bool get lastChance;
external set lastChance(bool value);
}