Skip to content

five-on-it / packages/net-client/src/input-history / InputHistory

Class: InputHistory ​

Defined in: packages/net-client/src/input-history.ts:30

The last inputs sent, numbered one after the other, and when a frame last went.

Constructors ​

Constructor ​

new InputHistory(): InputHistory

Returns ​

InputHistory

Accessors ​

size ​

Get Signature ​

get size(): number

Defined in: packages/net-client/src/input-history.ts:37

How many inputs the history holds (at most eight).

Returns ​

number

Methods ​

frame() ​

frame(count, ack, now): Uint8Array

Defined in: packages/net-client/src/input-history.ts:50

The frame to send at now (ms): the newest count inputs and the snapshot tick to acknowledge.

Parameters ​

count ​

number

ack ​

number

now ​

number

Returns ​

Uint8Array


idle() ​

idle(ack, now): Uint8Array<ArrayBufferLike> | undefined

Defined in: packages/net-client/src/input-history.ts:60

The acknowledgement alone, when no frame went for IDLE_ACK_MS up to now (ms); else undefined.

Parameters ​

ack ​

number

now ​

number

Returns ​

Uint8Array<ArrayBufferLike> | undefined


push() ​

push(message): void

Defined in: packages/net-client/src/input-history.ts:42

Remembers an input applied and about to be sent; one numbered past a gap forgets those before it.

Parameters ​

message ​

InputMessage

Returns ​

void