Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. Lock
  4. mode

Lock: mode property

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨March 2022⁩.

Secure context: This feature is available only insecure contexts (HTTPS), in some or allsupporting browsers.

Note: This feature is available inWeb Workers.

Themode read-only property of theLock interface returns the access mode passed toLockManager.request() when the lock was requested.The mode is either"exclusive" (the default) or"shared".

Value

One of"exclusive" or"shared".

Examples

The following examples show how the mode property is passed in the call toLockManager.request().LockManager is the object returned bynavigator.locks.

js
// Should show "exclusive" (the default)navigator.locks.request("my_resource", showLockProperties);// Should show "exclusive"navigator.locks.request(  "my_resource",  { mode: "exclusive" },  showLockProperties,);// Should show "shared"navigator.locks.request("my_resource", { mode: "shared" }, showLockProperties);function showLockProperties(lock) {  console.log(`The lock name is: ${lock.name}`);  console.log(`The lock mode is: ${lock.mode}`);}

Specifications

Specification
Web Locks API
# dom-lock-mode

Browser compatibility

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp