forked from rescript-lang/experimental-rescript-webapi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWebLocksAPI.res
More file actions
47 lines (39 loc) · 949 Bytes
/
WebLocksAPI.res
File metadata and controls
47 lines (39 loc) · 949 Bytes
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
@@warning("-30")
open EventAPI
type lockMode =
| @as("exclusive") Exclusive
| @as("shared") Shared
/**
[See LockManager on MDN](https://developer.mozilla.org/docs/Web/API/LockManager)
*/
@editor.completeFrom(LockManager)
type lockManager = {}
/**
[See Lock on MDN](https://developer.mozilla.org/docs/Web/API/Lock)
*/
type lock = {
/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Lock/name)
*/
name: string,
/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Lock/mode)
*/
mode: lockMode,
}
type lockInfo = {
mutable name?: string,
mutable mode?: lockMode,
mutable clientId?: string,
}
type lockManagerSnapshot = {
mutable held?: array<lockInfo>,
mutable pending?: array<lockInfo>,
}
type lockOptions = {
mutable mode?: lockMode,
mutable ifAvailable?: bool,
mutable steal?: bool,
mutable signal?: abortSignal,
}
type lockGrantedCallback = lock => promise<JSON.t>