-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start incorporating revised API from #10
- Loading branch information
1 parent
7a5377d
commit b116905
Showing
3 changed files
with
46 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,40 @@ | ||
// | ||
// Common | ||
// | ||
|
||
enum LockMode { "shared", "exclusive" }; | ||
|
||
dictionary LockOptions { | ||
LockMode mode = "exclusive"; | ||
boolean ifAvailable = false; | ||
AbortSignal signal; | ||
partial interface Navigator { | ||
[SecureContext] readonly attribute LockManager locks; | ||
}; | ||
|
||
// ====================================================================== | ||
// Proposal 1 - Auto-Release with waitUntil() | ||
// | ||
|
||
[SecureContext] | ||
interface LockManager { | ||
Promise<any> acquire((DOMString or sequence<DOMString>) scope, | ||
LockRequestCallback callback, | ||
optional LockOptions options); | ||
|
||
partial interface WindowOrWorkerGlobalScope { | ||
[SecureContext] | ||
Promise<Lock> requestLock((DOMString or sequence<DOMString>) scope, | ||
optional LockOptions options); | ||
Promise<LockState> queryState(); | ||
void forceRelease((DOMString or sequence<DOMString>) scope); | ||
}; | ||
|
||
[SecureContext, Exposed=(Window,Worker)] | ||
interface Lock { | ||
readonly attribute FrozenArray<DOMString> scope; | ||
readonly attribute LockMode mode; | ||
readonly attribute Promise<void> released; | ||
|
||
void waitUntil(Promise<any> p); | ||
}; | ||
callback LockRequestCallback = Promise<any> (Lock lock); | ||
|
||
// ====================================================================== | ||
// Proposal 2 - Explicit Release | ||
// | ||
enum LockMode { "shared", "exclusive" }; | ||
|
||
partial interface WindowOrWorkerGlobalScope { | ||
[SecureContext] | ||
Promise<Lock> requestLock((DOMString or sequence<DOMString>) scope, | ||
optional LockOptions options); | ||
dictionary LockOptions { | ||
LockMode mode = "exclusive"; | ||
boolean ifAvailable = false; | ||
AbortSignal signal; | ||
}; | ||
|
||
[SecureContext, Exposed=(Window,Worker)] | ||
interface Lock { | ||
readonly attribute FrozenArray<DOMString> scope; | ||
readonly attribute LockMode mode; | ||
readonly attribute Promise<void> released; | ||
|
||
void release(); | ||
}; | ||
|
||
// ====================================================================== | ||
// Proposal 3 - Scoped Release | ||
// | ||
|
||
callback LockRequestCallback = Promise<any> (Lock lock); | ||
|
||
partial interface WindowOrWorkerGlobalScope { | ||
[SecureContext] | ||
Promise<any> requestLock((DOMString or sequence<DOMString>) scope, | ||
LockRequestCallback callback, | ||
optional LockOptions options); | ||
dictionary LockState { | ||
held sequence<LockRequest>; | ||
pending sequence<LockRequest>; | ||
}; | ||
|
||
[SecureContext, Exposed=(Window,Worker)] | ||
interface Lock { | ||
readonly attribute FrozenArray<DOMString> scope; | ||
readonly attribute LockMode mode; | ||
readonly attribute Promise<void> released; | ||
dictionary LockRequest { | ||
sequence<DOMString> scope; | ||
LockMode mode; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters