bndr-js

bndr-js - v0.18.0

Emitters

Interfaces

Generators

gamepad

gamepad(this, ...args): GamepadEmitter

Parameters

NameType
thisany
...args[]

Returns

GamepadEmitter

Defined in

src/memoize.ts:50open in new window


keyboard

keyboard(target?): KeyboardEmitter

Parameters

NameTypeDefault value
targetstring | Window | HTMLElementwindow

Returns

KeyboardEmitter

Defined in

src/generator/keyboard.ts:343open in new window


midi

midi(this, ...args): MidiEmitter

Parameters

NameType
thisany
...args[]

Returns

MidiEmitter

Defined in

src/memoize.ts:50open in new window


mouse

mouse(target?): PointerEmitter

Parameters

NameTypeDefault value
targetPointerEmitterTargetdocument

Returns

PointerEmitter

Defined in

src/generator/pointer.ts:613open in new window


pen

pen(target?): PointerEmitter

Parameters

NameTypeDefault value
targetPointerEmitterTargetdocument

Returns

PointerEmitter

Defined in

src/generator/pointer.ts:619open in new window


pointer

pointer(this, ...args): PointerEmitter

Parameters

NameType
thisany
...args[target: PointerEmitterTarget]

Returns

PointerEmitter

Defined in

src/memoize.ts:50open in new window


touch

touch(target?): PointerEmitter

Parameters

NameTypeDefault value
targetPointerEmitterTargetdocument

Returns

PointerEmitter

Defined in

src/generator/pointer.ts:625open in new window

Combinators

and

and(...emitters): Emitter<boolean>

Creates a emitter that emits true when all of the given emitters emit truthy values.

Parameters

NameTypeDescription
...emittersEmitter<any>[]Emitters to combine.

Returns

Emitter<boolean>

A new emitter

Defined in

src/combinator.ts:92open in new window


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

NameTypeDescription
...emittersEmitter<any>[]Emitters to combine.

Returns

Emitter<boolean>

A cascading emitter.

Defined in

src/combinator.ts:43open in new window


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

NameType
...emittersEmitter<T>[]

Returns

Emitter<T>

A combined input event.

Defined in

src/combinator.ts:12open in new window


or

or(...emitters): Emitter<boolean>

Creates a emitter that emits true when any of the given emitters emit truthy values.

Parameters

NameTypeDescription
...emittersEmitter<any>[]Emitters to combine.

Returns

Emitter<boolean>

A new emitter

Defined in

src/combinator.ts:120open in new window


tuple

tuple<T>(...emitters): Emitter<UnwrapEmitters<T>>

Creates an input event with tuple type from given inputs.

Type parameters

NameType
Textends Emitter<any>[]

Parameters

NameType
...emittersT

Returns

Emitter<UnwrapEmitters<T>>

An integrated input event with the tuple type of given input events.

Defined in

src/combinator.ts:152open in new window

Global Functions

disposeAllEmitters

disposeAllEmitters(): void

Disposes all Emitter instances

Returns

void

Defined in

src/global.ts:24open in new window

Functions

createScope

createScope(fn): () => void

Creates a scope for Emitter instances so that they can be disposed by calling the return value.

Parameters

NameTypeDescription
fn() => voidThe 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

src/global.ts:45open in new window

Type Aliases

AxisName

Ƭ AxisName: "left" | "right" | number

Defined in

src/generator/gamepad.ts:90open in new window


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 specificationsopen in new window, it also supports vendor-specific names such as Nintendo Switch and PlayStation.

Defined in

src/generator/gamepad.ts:11open in new window


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

src/global.ts:74open in new window


Icon

Ƭ Icon: { icon: string ; type: "iconify" } | string

Defined in

src/types.ts:1open in new window


IconSequence

Ƭ IconSequence: Icon[]

Defined in

src/types.ts:3open in new window


MIDIData

Ƭ MIDIData: [number, number, number]

Defined in

src/generator/midi.ts:4open in new window