HomeGuidesAPI Reference
HubBlogChangelogSupport ForumLog In
API Reference

Node.js SDK - RainwayInput

Home > rainway-sdk-native > RainwayInput

RainwayInput type

An input to perform in an interactive stream.

This is a discriminated union type: match on type to distinguish types of input, and then handle the fields of the narrowed type.

See: https://basarat.gitbook.io/typescript/type-system/discriminated-unions

Signature:

export declare type RainwayInput = Readonly<({
    type: InputType.Gamepad;
} & IGamepadReport) | ({
    type: InputType.MouseAbsolute;
} & IMouseAbsolute) | ({
    type: InputType.MouseRelative;
} & IMouseRelative) | ({
    type: InputType.MouseClick;
} & IMouseClick) | ({
    type: InputType.MouseScroll;
} & IMouseScroll) | {
    type: InputType.Keyboard;
    action: RainwayKeyboardAction;
    key: RainwayVirtualKey;
} | ({
    type: InputType.PasteText;
} & ILogicalInput) | ({
    type: InputType.TouchesAbsolute;
} & ITouchesAbsolute) | ({
    type: InputType.PenAbsolute;
} & IPenAbsolute) | ({
    type: InputType.ViewportResize;
} & IViewportResize) | ({
    type: InputType.SetClipboardText;
} & ISetClipboardText)>;

References: InputType.Gamepad, IGamepadReport, InputType.MouseAbsolute, IMouseAbsolute, InputType.MouseRelative, IMouseRelative, InputType.MouseClick, IMouseClick, InputType.MouseScroll, IMouseScroll, InputType.Keyboard, RainwayKeyboardAction, RainwayVirtualKey, InputType.PasteText, ILogicalInput, InputType.TouchesAbsolute, ITouchesAbsolute, InputType.PenAbsolute, IPenAbsolute, InputType.ViewportResize, IViewportResize, InputType.SetClipboardText, ISetClipboardText