Home Reference Source
import Typed from 'typed.js/src/typed.js'
public class | source

Typed

Welcome to Typed.js!

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public
public
public

cursor: *

public
public
public

stopNum: *

public
public
public

timeout: *

public

Method Summary

Public Methods
public

Destroy this instance of Typed

public

reset(restart: boolean)

Reset Typed and optionally restarts

public

start()

Start typing / backspacing after being stopped

public

stop()

Stop typing / backspacing and enable cursor blinking

public

toggle()

Toggle start() and stop() of the Typed instance

Private Methods
private

backspace(curString: string, curStrPos: number): *

Backspaces 1 character at a time

private

begin()

Begins the typing animation

private

If using input elements, bind focus in order to start and stop the animation

private

Full animation is complete

private

doneTyping(curString: string, curStrPos: number)

We're done typing the current string

private

humanizer(speed: number): *

Speed in MS to type

private

Adds a CSS class to fade out current string

private

On init, insert the cursor element

private

keepTyping(curString: string, curStrPos: number)

Continue to the next string & begin typing

private

Replaces current text in the HTML element depending on element type

private

setPauseStatus(curString: string, curStrPos: number, isTyping: boolean)

Has the typing been stopped

private

Shuffle the sequence of the strings array

private

toggleBlinking(isBlinking: boolean)

Toggle the blinking cursor

private

typewrite(curString: string, curStrPos: number)

Called for each character typed

Public Constructors

public constructor() source

Public Members

public arrayPos: number source

public curLoop: number source

public cursor: * source

public cursorBlinking: * source

public sequence: * source

public stopNum: * source

public strPos: number source

public temporaryPause: boolean source

public timeout: * source

public typingComplete: boolean source

Public Methods

public destroy() source

Destroy this instance of Typed

public reset(restart: boolean) source

Reset Typed and optionally restarts

Params:

NameTypeAttributeDescription
restart boolean

public start() source

Start typing / backspacing after being stopped

public stop() source

Stop typing / backspacing and enable cursor blinking

public toggle() source

Toggle start() and stop() of the Typed instance

Private Methods

private backspace(curString: string, curStrPos: number): * source

Backspaces 1 character at a time

Params:

NameTypeAttributeDescription
curString string

the current string in the strings array

curStrPos number

the current position in the curString

Return:

*

private begin() source

Begins the typing animation

private bindFocusEvents() source

If using input elements, bind focus in order to start and stop the animation

private complete() source

Full animation is complete

private doneTyping(curString: string, curStrPos: number) source

We're done typing the current string

Params:

NameTypeAttributeDescription
curString string

the current string in the strings array

curStrPos number

the current position in the curString

private humanizer(speed: number): * source

Speed in MS to type

Params:

NameTypeAttributeDescription
speed number

Return:

*

private initFadeOut(): * source

Adds a CSS class to fade out current string

Return:

*

private insertCursor() source

On init, insert the cursor element

private keepTyping(curString: string, curStrPos: number) source

Continue to the next string & begin typing

Params:

NameTypeAttributeDescription
curString string

the current string in the strings array

curStrPos number

the current position in the curString

private replaceText(str: string) source

Replaces current text in the HTML element depending on element type

Params:

NameTypeAttributeDescription
str string

private setPauseStatus(curString: string, curStrPos: number, isTyping: boolean) source

Has the typing been stopped

Params:

NameTypeAttributeDescription
curString string

the current string in the strings array

curStrPos number

the current position in the curString

isTyping boolean

private shuffleStringsIfNeeded() source

Shuffle the sequence of the strings array

private toggleBlinking(isBlinking: boolean) source

Toggle the blinking cursor

Params:

NameTypeAttributeDescription
isBlinking boolean

private typewrite(curString: string, curStrPos: number) source

Called for each character typed

Params:

NameTypeAttributeDescription
curString string

the current string in the strings array

curStrPos number

the current position in the curString