Options
All
  • Public
  • Public/Protected
  • All
Menu
description

Typewriter

Hierarchy

  • default

Implements

  • IActions

Index

Constructors

constructor

  • new default(element: string | HTMLElement, config?: default): default
  • description

    Instantiates the typewriter

    Parameters

    • element: string | HTMLElement

      The target element or selector

    • Optional config: default

      The global configuration object

    Returns default

Properties

actionManager

actionManager: default
description

Action manager

Readonly audio

audio: default
description

The audio utility responsible for playing SFX

config

config: default
description

Global configuration

Readonly context

context: default
description

The typewriter's context

events

events: { event: string; func: Func<any> }[]
description

Event list

Private renderer

renderer: default
description

The renderer responsible on rendering the typewriter's output

Accessors

errorHandler

  • get errorHandler(): Func<any>
  • description

    Returns the event handler

    Returns Func<any>

getHighlight

  • get getHighlight(): string
  • description

    Returns the highlighted content

    Returns string

getHtml

  • get getHtml(): string
  • description

    Returns HTML text content

    Returns string

getText

  • get getText(): string
  • description

    Returns raw text content

    Returns string

Methods

after

  • after<T>(event: string, func: Func<T>): void
  • description

    Subscribes to events

    Type parameters

    • T

    Parameters

    • event: string

      The event name

    • func: Func<T>

      Callback

    Returns void

before

  • before<T>(event: string, func: Func<T>): void
  • description

    Subscribes to events

    Type parameters

    • T

    Parameters

    • event: string

      The event name

    • func: Func<T>

      Callback

    Returns void

catch

  • catch<T>(handler: Func<T>): void
  • description

    Hooks the event handler

    Type parameters

    • T

    Parameters

    • handler: Func<T>

      The event handler

    Returns void

delete

  • delete(times: number, config?: IActionConfig): default
  • description

    Initiates a delete action

    Parameters

    • times: number

      Number of deletions

    • Optional config: IActionConfig

      The action configuration

    Returns default

exec

  • description

    Initiates anb exec action

    Parameters

    • func: Promise<void>

      The user-defined action

    Returns default

highlight

  • highlight(index: number, config?: IActionConfig): default
  • description

    Highlights content

    Parameters

    • index: number

      The target index

    • Optional config: IActionConfig

      The action configuration

    Returns default

move

  • move(index: number, config?: IActionConfig): default
  • description

    Initiates a move action

    Parameters

    • index: number

      The target index

    • Optional config: IActionConfig

      The action configuration

    Returns default

reset

  • reset(): void
  • description

    Resets the entire typewriter

    Returns void

return

  • return(config?: IActionConfig): default
  • description

    Inserts carriage return

    Parameters

    • Optional config: IActionConfig

      The action configuration

    Returns default

sleep

  • description

    Initiates a sleep action

    Parameters

    • time: number

      The timeout time in milliseconds

    Returns default

start

  • start(): Promise<void>
  • description

    Starts the actions queue

    Returns Promise<void>

tab

  • tab(index?: number, config?: IActionConfig): default
  • description

    Inserts tabulation

    Parameters

    • index: number = 4
    • Optional config: IActionConfig

      The action configuration

    Returns default

type

  • type(input: string, config?: IActionConfigType): default
  • description

    Initiates a type action

    Parameters

    • input: string

      The target input

    • Optional config: IActionConfigType

      The action configuration

    Returns default

update

  • update(): void
  • description

    The update callback, called from inside every action

    Returns void

Generated using TypeDoc