requestPointerLock method
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 firingDocument.pointerlockchange_event
orDocument.pointerlockerror_event
events. A proposed update to the specification updatesrequestPointerLock()
to return aPromise
which communicates success or failure. This page documents the version that returns aPromise
. 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]);