pointer-lock0.0.4 • Public • Published
pointer-lock api exposed as an event emitter that emits readable streams of mouse movement data. automatically handles adding appropriate mousedown/up event listeners on the targeted element. tries to reuse objects instead of creating new objects, to keep garbage generation low. may sing you songs, if you're nice enough to it.
var lock =my_element = documentif!lockreturn// my_element can be any element currently attached to// the document -- but not the document itself (document.body on down// is fine.)var pointer =pointerpointerpointerpointer// request pointer lock: warning, may require being called from a mouse event listenerpointer// releases the pointer lock session, if any.pointer// current pointer lock element, if any.pointertarget// remove the mouse event listeners added by lockpointer