UNPKG

@mixer/interactive-node

Version:

A NodeJS and Browser compatible client for mixer.com's interactive 2 Protocol

63 lines (62 loc) 2.22 kB
import { ITextboxInput } from '../interfaces/controls/IInput'; import { ITextbox, ITextboxData, ITextboxUpdate } from '../interfaces/controls/ITextbox'; import { Control } from './Control'; /** * Textboxes can be used by participants to send text to the game. */ export declare class Textbox extends Control<ITextboxData> implements ITextbox { /** * The text hint inside the textbox, presented to the participants. * Set this value using [setPlaceholder]{@link Textbox.setPlaceholder} */ placeholder: string; /** * The spark cost of this textbox in sparks. * Set this value using [setCost]{@link Textbox.setCost} */ cost: number; /** * If set this value is the Unix Timestamp at which this textbox's cooldown will expire. * Set this value using [setCooldown]{@link Textbox.setCooldown} */ cooldown: number; /** * The text displayed within the submit button for the textbox. * Set this value using [setSubmitText]{@link Textbox.setSubmitText} */ submitText: string; /** * Shows the submit button for the textbox, presented to the participants. */ hasSubmit: boolean; /** * Sets the textbox displayed to the participants to be singleline or multiline. */ multiline: boolean; /** * Sets a new placeholder value for this textbox. */ setPlaceholder(placeholder: string): Promise<void>; /** * Sets a new submit button text value for this textbox. */ setSubmitText(submitText: string): Promise<void>; /** * Sets the cooldown for this textbox. Specified in Milliseconds. * The Client will convert this to a Unix timestamp for you. */ setCooldown(duration: number): Promise<void>; /** * Sets the spark cost for this textbox. * An Integer greater than 0 */ setCost(cost: number): Promise<void>; /** * Sends an input event from a participant to the server for consumption. */ giveInput(input: ITextboxInput): Promise<void>; /** * Update this textbox on the server. */ update(controlUpdate: ITextboxUpdate): Promise<void>; }