Namespace: SpawnDev.SpawnJS.JSObjects
Source: JSObjects/LockRequestOptions.cs
MDN Reference: LockRequestOptions on MDN
An object describing characteristics of the lock you want to create. https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request#options
| Property | Type | Access | Description |
|---|---|---|---|
LockRequestOptions |
class |
get | An object describing characteristics of the lock you want to create. https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request#options |
IfAvailable |
bool? |
get | |
Steal |
bool? |
get | |
Signal |
AbortSignal? |
get |
SpawnDev.SpawnJS Mapping Note: The JavaScript examples below show the standard Web API usage. In SpawnDev.SpawnJS, the same API is available with C# conventions:
- Properties and methods use PascalCase (e.g.,
readyStatebecomesReadyState)- Events use ActionEvent with
+=/-=(e.g.,addEventListener("click", fn)becomesOnClick += handler)- Async methods return
Task<T>instead ofPromise<T>- Objects should be disposed with
usingstatements- Access via
JS.Get<LockRequestOptions>(...)or constructornew LockRequestOptions(...)
await navigator.locks.request("my_resource", async (lock) => {
// The lock was granted.
});async function doRead() {
await navigator.locks.request(
"my_resource",
{ mode: "shared" },
async (lock) => {
// Read code here.
},
);
}async function doWrite() {
await navigator.locks.request(
"my_resource",
{ mode: "exclusive" },
async (lock) => {
// Write code here.
},
);
}