Class “Percent”

Object > Percent

Represents a percentage. See also PercentValue

Type: Percent extends Object
Constructor: public
Singleton: No
Namespace: tabris
Direct subclasses: None
JSX Support: No

Constructor

new Percent(value)

Parameter Type Description
value number 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 Description
percentValue PercentValue 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 Description
value any The value to test

Returns: value

Properties

percent

A number between and including 0 and 100

Type: number
Settable: No

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