-
Notifications
You must be signed in to change notification settings - Fork 0
/
package.json
41 lines (41 loc) · 3.01 KB
/
package.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
{
"name": "pointer-lock",
"version": "0.0.3",
"description": "pointer lock polyfill that presents an eventemitter / stream api",
"main": "index.js",
"directories": {
"test": "test"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git://github.com/chrisdickinson/pointer-lock.git"
},
"keywords": [
"pointer-lock",
"pointer",
"lock",
"browserify"
],
"author": {
"name": "Chris Dickinson",
"email": "chris@neversaw.us"
},
"license": "MIT",
"devDependencies": {
"fullscreen": "0.0.1"
},
"readme": "# pointer-lock\n\npointer-lock api exposed as an event emitter that emits readable streams\nof mouse movement data. automatically handles adding appropriate mousedown/up\nevent listeners on the targeted element. tries to reuse objects instead of creating\nnew objects, to keep garbage generation low. may sing you songs, if you're nice\nenough to it.\n\n```javascript\nvar lock = require('pointer-lock')\n , my_element = document.getElementById('element')\n\nif(!lock.available())\n return alert('not available!')\n\n// my_element can be any element currently attached to\n// the document -- but not the document itself (document.body on down\n// is fine.)\nvar pointer = lock(my_element)\n\npointer.on('attain', function(movements) {\n var initial = {x: movements.x, y: movements: y}\n\n // movements is a readable stream\n movements.on('data', function(move) {\n // be sure to copy the data *out of* move,\n // as the move object is reused.\n initial.x += move.dx\n initial.y += move.dy\n initial.t += move.dt\n })\n\n movements.on('close', function() {\n // no more movements from this pointer-lock session.\n })\n})\n\npointer.on('release', function() {\n // pointer has been released\n})\n\npointer.on('error', function() {\n // user denied pointer lock OR it's not available\n})\n\npointer.on('needs-fullscreen', function() {\n // some browsers require you to be in fullscreen mode\n // for pointer lock.\n // this lets you catch that case and request it after\n // you've requested fullscreen.\n var fullscreen = require('fullscreen')\n , fs = fullscreen(my_element)\n\n fs.once('attain', function() {\n // manually re-request pointer lock\n pointer.request()\n })\n\n // request fullscreen!\n fs.request()\n})\n\n// request pointer lock: warning, may require being called from a mouse event listener\npointer.request()\n\n// releases the pointer lock session, if any.\npointer.release()\n\n// current pointer lock element, if any.\npointer.target()\n\n// remove the mouse event listeners added by lock\npointer.destroy()\n\n```\n\n# license\n\nMIT\n",
"readmeFilename": "README.md",
"bugs": {
"url": "https://github.com/chrisdickinson/pointer-lock/issues"
},
"_id": "pointer-lock@0.0.3",
"dist": {
"shasum": "72421eef598f437c90f0a730ec1317a9f72febbb"
},
"_from": "pointer-lock@0.0.3",
"_resolved": "https://registry.npmjs.org/pointer-lock/-/pointer-lock-0.0.3.tgz"
}