jspointerlock
v1.0.0
Published
W3C Pointer Lock Fallback
Downloads
23
Maintainers
Readme
jsPointerLock
W3C Pointer Lock Fallback
Specification
Usage
I suggest you to use jspm as your package manager.
import PointerLock from "jspointerlock";
const pointerLock = new PointerLock(document.body);
pointerLock.on("change", (isLocked) => {
console.log(`pointer is ${isLocked ? 'locked' : 'not locked'}`);
});
pointerLock.element.addEventListener("click", () => {
pointerLock.requestPointerLock();
});
Directly in a browser
Please checkout the index-dist.html file for direct usage in a browser.
API
Classes
- PointerLock
- Constructor(Element element) extends EventEmitter
- Members
- requestPointerLock() => Void
- Static Members
- exitPointerLock() => Void
- Properties
- element => Element
- isLocked => Boolean
- Static Properties
- isSupported => Boolean
- pointerLockElement => Element
- Events
- change => (Boolean isLocked, Event e)
- error => (Error err, Event e)
- unsupported => ()