Txt

Txt

Display text or html

Constructor

new Txt(data)

Parameters:
Name Type Description
data iTxtConstructor

Object with parameters.

Source:
Example
let info = new Txt("Simple text");
let description = new Txt({
    html: "<b>Key</b>: {0}",
    placeholder: ["Value"]
});

Extends

Methods

(static) value(value, placeholders)

Value To replace placeholders in text.

Parameters:
Name Type Description
value string

String of text.

placeholders Array.<string>

List of placeholders if it need to replace "{index}"

Source:
Example
let text = Txt.value("Value is: {0}, old value is: {1}", ["2", "3"]);

addListener(value) → {void}

Add new event listener

Parameters:
Name Type Description
value Listener

Listener object

Overrides:
Source:

className(value) → {string}

Get/Set style-classes

Parameters:
Name Type Description
value String

To set new string of style-classes

Overrides:
Source:

html(value, placeholders)

html To get/set string of html.

Parameters:
Name Type Description
value string | undefined

String of html.

placeholders Array.<string> | undefined

List of placeholders if it need to replace "{index}"

Source:
Example
txt.html("<b>Old text string</b>: empty");
 txt.html("<b>New text string</b>: {0}", ["Example"]);

listen(name, cb, after) → {Listener}

To listen event from this component

Parameters:
Name Type Description
name string

Name of event

cb function

Callback for fired event

after boolean

For phase before changes if "false" (by default) or after changes if "true"

Overrides:
Source:

removeListener(value) → {void}

To remove installed event listener

Parameters:
Name Type Description
value Listener

Listener object

Overrides:
Source:

removeListeners() → {void}

To remove all installed event listeners

Overrides:
Source:

text(value, placeholders)

Text To get/set string of text.

Parameters:
Name Type Description
value string | undefined

String of text.

placeholders Array.<string> | undefined

List of placeholders if it need to replace "{index}"

Source:
Example
txt1.text("Old text string: empty");
 txt2.text("New text string: {0}", ["Example"]);

trigger(value) → {Action}

To fire event

Parameters:
Name Type Description
value Action | string

Action object

Overrides:
Source: