Liking cljdoc? Tell your friends :D

infinitelives.utils.events

Browser events

Browser events
raw docstring

!gamepad-connected-callbackscljs

source

!gamepadscljs

source

*devtools-passthrough*cljs

source

*frame-chans*cljs

source

*resize-chans*cljs

source

allow-key-defaultscljs

source

any-pressed?cljs

(any-pressed?)

Is any key on the keyboard pressed?

Is any key on the keyboard pressed?
sourceraw docstring

asciicljs

(ascii c)

A clojurescript version of ascii value of. javascript doesn't have a char type, but uses a string of length 1 to represent

A clojurescript version of ascii value of. javascript doesn't have
a char type, but uses a string of length 1 to represent
sourceraw docstring

clear-frame-chans!cljs

(clear-frame-chans!)
source

clear-resize-chans!cljs

(clear-resize-chans!)
source

del-frame-chan!cljs

(del-frame-chan! c)
source

del-resize-chancljs

(del-resize-chan c)
source

fallback-fpscljs

source

frame-event-chan-handlercljs

(frame-event-chan-handler ev)
source

gamepad-handler-installedcljs

source

get-gamepad-event-indexcljs

(get-gamepad-event-index ev)
source

get-gamepadscljs

source

handle-keydown-eventcljs

(handle-keydown-event ev)

the base event handler for key down events. Takes the keycode and sets that key in the key-state dictionary to true

the base event handler for key down events. Takes the keycode
and sets that key in the key-state dictionary to true
sourceraw docstring

handle-keyup-eventcljs

(handle-keyup-event ev)

the basic event handler for key up events. Takes the keycode and removes it as a key from the key-state dictionary

the basic event handler for key up events. Takes the keycode
and removes it as a key from the key-state dictionary
sourceraw docstring

initiate-gamepad-callbackscljs

(initiate-gamepad-callbacks gamepad-index gamepad-data)
source

install-frame-handler!cljs

(install-frame-handler!)

install the frame callback to send frame chan messages

install the frame callback to send frame chan messages
sourceraw docstring

install-gamepad-handler!cljs

(install-gamepad-handler!)
source

install-gamepad-listenercljs

(install-gamepad-listener callback)
source

install-key-handler!cljs

(install-key-handler!)

install the keyup and keydown event handlers

install the keyup and keydown event handlers
sourceraw docstring

install-resize-handler!cljs

(install-resize-handler!)

install the resize callback to resize the main canvas renderer

install the resize callback to resize the main canvas renderer
sourceraw docstring

is-pressed?cljs

(is-pressed? code)

returns true if the key is pressently down. code is a keyword, or a string of length 1. Examples:

;; test if keys are down by keyword
(is-pressed? :backspace)
(is-pressed? :f10)
(is-pressed? :left)
(is-pressed? :space)
(is-pressed? :w)
(is-pressed? :a)

;; test if keys are down by string
(is-pressed? " ")
(is-pressed? "w")
(is-pressed? "a")
(is-pressed? "d")
(is-pressed? "s")

See key-codes for a list of keyword keys.

returns true if the key is pressently down. code is a keyword,
or a string of length 1. Examples:

```
;; test if keys are down by keyword
(is-pressed? :backspace)
(is-pressed? :f10)
(is-pressed? :left)
(is-pressed? :space)
(is-pressed? :w)
(is-pressed? :a)

;; test if keys are down by string
(is-pressed? " ")
(is-pressed? "w")
(is-pressed? "a")
(is-pressed? "d")
(is-pressed? "s")
```

See key-codes for a list of keyword keys.
sourceraw docstring

key-codescljs

A hashmap with a variety of keys (strings, keywords). mapping to browser key codes. Use the is-pressed? function to test keys directly.

Keycodes can be any string of length 1 representing a key (lowercase). Keycodes can also be any of the following keywords

:backspace :tab :enter :shift :control :alt :pause :capslock :esc :space :pageup :pagedown :end :home :left :up :right :down :insert :delete :f1 :f2 :f3 :f4 :f5 :f6 :f7 :f8 :f9 :f10 :f11 :f12 :numlock :scrolllock :comma :. :/ :backtick :squareleft :backslash :squareright :quote

or any of the single alphanumeric lowercase characters as keywords

eg. :w :a :s :d :1 :5 etc.

A hashmap with a variety of keys (strings, keywords).
mapping to browser key codes. Use the is-pressed? function to test
keys directly.

Keycodes can be any string of length 1 representing a key (lowercase).
Keycodes can also be any of the following keywords

:backspace :tab :enter :shift :control :alt :pause :capslock :esc :space
:pageup :pagedown :end :home :left :up :right :down :insert :delete :f1
:f2 :f3 :f4 :f5 :f6 :f7 :f8 :f9 :f10 :f11 :f12 :numlock :scrolllock :comma
:. :/ :backtick :squareleft :backslash :squareright :quote

or any of the single alphanumeric lowercase characters as keywords

eg.
:w :a :s :d :1 :5 etc.
sourceraw docstring

key-configcljs

source

key-statecljs

source

make-get-gamepadscljs

(make-get-gamepads)
source

make-request-animation-framecljs

(make-request-animation-frame)

compose a function that is the r-a-f func. returns a function. This returned function takes a callback and ensures its called next frame

compose a function that is the r-a-f func. returns a function. This returned function takes a callback and ensures
its called next frame
sourceraw docstring

new-frame-chancljs

(new-frame-chan)
source

new-resize-chancljs

(new-resize-chan)
source

next-framecljs

(next-frame)

returns a single use channel which closes on next frame callback. pulling from it waits exactly one frame. eg

;; wait one frame
(<! (next-frame))
returns a single use channel which closes on next frame callback.
pulling from it waits exactly one frame. eg

```
;; wait one frame
(<! (next-frame))
```
sourceraw docstring

prevent-key-defaultscljs

source

request-animation-framecljs

schedules the passed in callback to be fired once, next animation frame.

schedules the passed in callback to be fired once, next animation frame.
sourceraw docstring

resize-event-chan-handlercljs

(resize-event-chan-handler ev)
source

set-gamepad-atom!cljs

(set-gamepad-atom! gamepad-index value)
source

set-prevent-key-defaultscljs

(set-prevent-key-defaults b)
source

wait-framescljs

(wait-frames frames)

returns a channel which closes when a certain number of frames have passed. eg

;; wait 10 frames
(<! (wait-frames 10))
returns a channel which closes when a certain number
of frames have passed. eg

```
;; wait 10 frames
(<! (wait-frames 10))
```
sourceraw docstring

wait-timecljs

(wait-time delay)

returns a channel which closes when a certain amount of time in milliseconds has passed, but determines that time by counting the requestAnimationFrame callbacks, so that when tab focus is lost, the callback, and thus this wait is suspended.

;; wait one seconds worth of frames
(<! (wait-time 1000))
returns a channel which closes when a certain amount of
time in milliseconds has passed, but determines that time by counting
the requestAnimationFrame callbacks, so that when tab focus is lost,
the callback, and thus this wait is suspended.

```
;; wait one seconds worth of frames
(<! (wait-time 1000))
```
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close