Skip to content

Non export classes

Mike edited this page May 27, 2021 · 6 revisions

Classes you don't need to know about.

Line

Base class for all lines

Add new line and get result:

const line = new Line();
lineHolder.appendChild(line.mainEl);
line.focus();
const result = line.ask(); //except Line and LineText, because they don't resolve Promise.

Line.ask()

Creates and returns Promise

Line.focus()

Sets focus to input, if any

Line.rejectPromise()

Reject Promise with text "TextGameEngine: Line removed before resolve"

used by TextGameEngine.clear()

LineText

Created by TextGameEngine.print()

const line = LineText(text: string, newParagraph: boolean, styles: TextStyles)

LineGetNum

Created by TextGameEngine.num()

const line = LineGetNum(min: number | null, max: number | null)

LineGetText

Created by TextGameEngine.text()

const line = LineGetText(min: number, max: number, trimSpaces: boolean, allowSpaces: boolean)

LineChoose

Created by TextGameEngine.choose()

const line = LineChoose(options: (string | number)[], newLine: boolean, removeNotChosen: boolean, styles: TextStyles)

TextStyles

Class that contains user styles and formats text

TextStyles.style()

Formats text and return HTMLDivElement with text

const textDiv = textStyles.style(text: string)

TextStyles.setStyles()

Sets new styles, converts strings into StyledText

textStyles.setStyles(styles: string[])

TextStyles.removeFormatting()

Removes formatting symbols from string

const text = textStyles.removeFormatting(text: string)

StyledText

Class that contain text and its style

Field Default
italic false
bold false
underline false
color ""
text ""
clearPrev false
link ""

clearPrev - used by parser