Class “Percent”

Object > Percent

Represents a percentage. See also PercentValue

Constructor public
Singleton No
Namespace tabris
Direct subclasses None
JSX support No

Constructor

new Percent(value)

Parameter Type Optional Description
value number No A number between and including 0 and 100

Methods

toString()

Returns a string representation of the percent (a number followed by ‘%’).

Returns string

valueOf()

Returns the percent number

Returns number

Static Methods

from(percentValue)

Creates a new instance of Percent using any valid percent expression. For any other value, including null the method throws.

Parameter Type Optional Description
percentValue PercentValue No The value to create a Percent instance from

Returns Percent

isValidPercentValue(value)

Returns true if value is a valid PercentValue. This excludes null. Use this to check if a value will be accepted by Percent.from. This is also a valid TypeScript type guard function.

Parameter Type Optional Description
value any No The value to test

Returns value is PercentValue

Properties

percent

A number between and including 0 and 100

Type number
Settable No
Change events No

This property can only be set via constructor. Once set, it cannot change anymore.