Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ardean/jspointerlock
W3C Pointer Lock Fallback
https://github.com/ardean/jspointerlock
events fallback html5-pointer-lock javascript jspointerlock jsremote pointerlock w3c w3c-pointer-lock
Last synced: 4 days ago
JSON representation
W3C Pointer Lock Fallback
- Host: GitHub
- URL: https://github.com/ardean/jspointerlock
- Owner: ardean
- License: mit
- Created: 2016-10-29T17:02:44.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-05-18T10:29:21.000Z (over 7 years ago)
- Last Synced: 2024-11-08T19:53:08.827Z (12 days ago)
- Topics: events, fallback, html5-pointer-lock, javascript, jspointerlock, jsremote, pointerlock, w3c, w3c-pointer-lock
- Language: JavaScript
- Homepage: https://ardean.github.io/jsPointerLock/
- Size: 259 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# jsPointerLock
[![NPM Version][npm-image]][npm-url]
[![NPM Downloads][downloads-image]][downloads-url]
[![License][license-image]][license-url]**W3C Pointer Lock Fallback**
## Specification
[Pointer Lock API, W3C](https://w3c.github.io/pointerlock/)## Usage
I suggest you to use [jspm](http://jspm.io/) as your package manager.
```js
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](https://ardean.github.io/jsPointerLock/index-dist.html) file for direct usage in a browser.
## API
### Classes
- _PointerLock_
- **Constructor**(**Element** element) extends **[EventEmitter](https://nodejs.org/api/events.html#events_class_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_ => ()## License
[MIT](LICENSE)
[npm-image]: https://img.shields.io/npm/v/jspointerlock.svg
[npm-url]: https://npmjs.org/package/jspointerlock
[downloads-image]: https://img.shields.io/npm/dm/jspointerlock.svg
[downloads-url]: https://npmjs.org/package/jspointerlock
[license-image]: https://img.shields.io/npm/l/jspointerlock.svg
[license-url]: LICENSE