bndr-js
bndr-js - v0.18.0
Emitters
Interfaces
Generators
gamepad
▸ gamepad(this
, ...args
): GamepadEmitter
Parameters
Name | Type |
---|---|
this | any |
...args | [] |
Returns
Defined in
keyboard
▸ keyboard(target?
): KeyboardEmitter
Parameters
Name | Type | Default value |
---|---|---|
target | string | Window | HTMLElement | window |
Returns
Defined in
midi
▸ midi(this
, ...args
): MidiEmitter
Parameters
Name | Type |
---|---|
this | any |
...args | [] |
Returns
Defined in
mouse
▸ mouse(target?
): PointerEmitter
Parameters
Name | Type | Default value |
---|---|---|
target | PointerEmitterTarget | document |
Returns
Defined in
pen
▸ pen(target?
): PointerEmitter
Parameters
Name | Type | Default value |
---|---|---|
target | PointerEmitterTarget | document |
Returns
Defined in
pointer
▸ pointer(this
, ...args
): PointerEmitter
Parameters
Name | Type |
---|---|
this | any |
...args | [target: PointerEmitterTarget] |
Returns
Defined in
touch
▸ touch(target?
): PointerEmitter
Parameters
Name | Type | Default value |
---|---|---|
target | PointerEmitterTarget | document |
Returns
Defined in
Combinators
and
▸ and(...emitters
): Emitter
<boolean
>
Creates a emitter that emits true
when all of the given emitters emit truthy values.
Parameters
Name | Type | Description |
---|---|---|
...emitters | Emitter <any >[] | Emitters to combine. |
Returns
Emitter
<boolean
>
A new emitter
Defined in
cascade
▸ cascade(...emitters
): Emitter
<boolean
>
- Creates a cascading emitter by combining multiple emitters. The resulting emitter emits
true
when the given emitters emit truthy values in a sequential manner from the beginning to the end of the list.
Parameters
Name | Type | Description |
---|---|---|
...emitters | Emitter <any >[] | Emitters to combine. |
Returns
Emitter
<boolean
>
A cascading emitter.
Defined in
combine
▸ combine<T
>(...emitters
): Emitter
<T
>
Integrates multiple input events of the same type. The input event is triggered when any of the input events is triggered.
Type parameters
Name |
---|
T |
Parameters
Name | Type |
---|---|
...emitters | Emitter <T >[] |
Returns
Emitter
<T
>
A combined input event.
Defined in
or
▸ or(...emitters
): Emitter
<boolean
>
Creates a emitter that emits true
when any of the given emitters emit truthy values.
Parameters
Name | Type | Description |
---|---|---|
...emitters | Emitter <any >[] | Emitters to combine. |
Returns
Emitter
<boolean
>
A new emitter
Defined in
tuple
▸ tuple<T
>(...emitters
): Emitter
<UnwrapEmitters
<T
>>
Creates an input event with tuple type from given inputs.
Type parameters
Name | Type |
---|---|
T | extends Emitter <any >[] |
Parameters
Name | Type |
---|---|
...emitters | T |
Returns
Emitter
<UnwrapEmitters
<T
>>
An integrated input event with the tuple type of given input events.
Defined in
Global Functions
disposeAllEmitters
▸ disposeAllEmitters(): void
Disposes all Emitter instances
Returns
void
Defined in
Functions
createScope
▸ createScope(fn
): () => void
Creates a scope for Emitter instances so that they can be disposed by calling the return value.
Parameters
Name | Type | Description |
---|---|---|
fn | () => void | The function to run in the scope |
Returns
fn
A function that disposes all Emitter instances created in the scope
▸ (): void
Returns
void
Example
const dispose = createScope(() => {
Bndr.keyboard()
.pressed('a')
.on(console.log)
})
dispose()
Defined in
Type Aliases
AxisName
Ƭ AxisName: "left"
| "right"
| number
Defined in
ButtonName
Ƭ ButtonName: number
| "b"
| "a"
| "x"
| "y"
| "l"
| "r"
| "zl"
| "zr"
| "select"
| "start"
| "stick-left"
| "stick-right"
| "up"
| "down"
| "left"
| "right"
| "home"
| "lsl"
| "lsr"
| "rsl"
| "rsr"
| "+"
| "-"
| "capture"
| "triangle"
| "circle"
| "square"
| "l1"
| "l2"
| "r1"
| "r2"
| "create"
| "option"
| "touch-pad"
| "lb"
| "rb"
| "lt"
| "rt"
| "view"
| "menu"
| "share"
Gamepad button name. In addition to W3C specifications, it also supports vendor-specific names such as Nintendo Switch and PlayStation.
Defined in
GeneratorPath
Ƭ GeneratorPath: string
The string representation of a Emitter. That can be used to create a new Emitter instance.
Example
"keyboard/command+s"
"keyboard/shift+enter"
"gamepad/b"
"gamepad/square"
Defined in
Icon
Ƭ Icon: { icon
: string
; type
: "iconify"
} | string
Defined in
IconSequence
Ƭ IconSequence: Icon
[]
Defined in
MIDIData
Ƭ MIDIData: [number
, number
, number
]