API Docs for: 7.2
Show:

MQA.Component Class

Module: MQA

Base class for components in the MQA Namespace

Constructor

MQA.Component

()

Methods

defineProperty

(
  • name
  • transformFunction
  • defaultValue
  • setTrigger
)

Dynamically define a property, complete with getters, setters, an optional transformFunction, default value and setTrigger. This method can be invoked on a function's prototype to create a permanent property for all instances.

Parameters:

  • name String

    Camel-cased property name

  • transformFunction Function

    (Optional) If defined, then the setter will filter the value to set through this function

  • defaultValue Object

    (Optional) If defined the default value to initialize immediately

  • setTrigger Function | String

    (Optional) If defined the given named trigger method will be called when the setter results in a change.

Example:

 myObj.defineProperty('myNewProp', parseInt, 0, function () { alert('myNewProp changed'); });
 myObj.setMyNewProp('1'); // Will trigger alert
 myObj.getMyNewProp();  // --> 1

 myObj.boolTrigger = function () { alert('bool changed'); };
 myObj.defineProperty('reallyBig', Boolean, false, 'boolTrigger');
 myObj.isReallyBig();   // --> false
 myObj.setReallyBig(1); // alert "bool changed"
 myObj.isReallyBig();   // --> true

dispose

()

Destroys the object. If you have resources that need cleaning up make sure it happens here to prevent leaks when objects are destroyed

getValue

(
  • pcKey
)
Mixed

Returns the value if it exists, undefined otherwise.

Parameters:

  • pcKey String

    The property name of the value to get.

Returns <Mixed>

The value of the specified property name. If the specified property does not exist, undefined is returned.

setValue

(
  • pcKey
  • pcValue
)
Boolean

Sets the specified key to the specified value.

Parameters:

  • pcKey String

    The key to the property

  • pcValue Mixed

    The value to set the property to.

Returns <Boolean>

true if the key exists and is set successfully, otherwise false.

setValues

(
  • pcValues
)
Number

Sets multiple properties for the object.

Parameters:

  • pcValues Object

    The key:value pairs to set where "key" is the property name and "value" is the value to set.

Returns <Number>

the number of objects set successfully