Public Member Functions | List of all members
Modal Class Reference

Public Member Functions

 Modal (Map specifiers, Format format)
 
String format (Value value)
 
Value getPrefix ()
 
 setPrefix (Value prefix)
 
Value getSuffix ()
 
 setSuffix (Value suffix)
 
 reset ()
 
Value getCurrent ()
 

Detailed Description

A modal unformatted variable. State is maintained to avoid output for unchanged values.

var gModal = createModal({prefix: "G"}); // note space before 'G'
var str1 = gModal.format(4); // returns "G4"
var str2 = gModal.format(4); // returns ""
var str3 = gModal.format(1); // returns "G1"

Constructor & Destructor Documentation

◆ Modal()

Modal ( Map  specifiers,
Format  format 
)

Constructs a modal variable.

Parameters
specifiersThe format specifiers.
formatThe desired format (optional).

The supported specifiers are:

  1. prefix: Specifies the prefix.
  2. suffix: Specifies the suffix.
  3. force: Specifies that the value must always be returned.

Member Function Documentation

◆ format()

String format ( Value  value)

Returns the corresponding string.

If the value is identical to the last value then the empty string is returned unless the force specifier has been set to true.

Parameters
valueThe value. This must be of type Number if a format has been specified.

◆ getCurrent()

Value getCurrent ( )

Returns the last formatted value.

◆ getPrefix()

Value getPrefix ( )

Returns the prefix.

◆ getSuffix()

Value getSuffix ( )

Returns the suffix.

◆ reset()

reset ( )

Invoke to force output of value on the next invocation of format(). reset() has no effect if force has been set to true.

◆ setPrefix()

setPrefix ( Value  prefix)

Sets the prefix.

◆ setSuffix()

setSuffix ( Value  suffix)

Sets the suffix.



Generated by Autodesk, Inc. 19 April 2024
Copyright (c) 2012-2024 by Autodesk, Inc.