requestPointerLock method

JSPromise<JSAny?> requestPointerLock([
  1. PointerLockOptions options
])
inherited

The requestPointerLock() method of the Element interface lets you asynchronously ask for the pointer to be locked on the given element.

To track the success or failure of the request, it is necessary to listen for the Document.pointerlockchange_event and Document.pointerlockerror_event events at the Document level.

Note: In the current specification, requestPointerLock() only communicates the success or failure of the request by firing Document.pointerlockchange_event or Document.pointerlockerror_event events. A proposed update to the specification updates requestPointerLock() to return a Promise which communicates success or failure. This page documents the version that returns a Promise. However, note that this version is not yet a standard and is not implemented by all browsers. See Browser compatibility for more information.

Implementation

external JSPromise<JSAny?> requestPointerLock([PointerLockOptions options]);