Class gui.SessionConstraints
Defined in: SessionConstraints.js.
Constructor Attributes | Constructor Name and Description |
---|---|
This class allows handling of 'constraints', which are modelled
as a name (string) with a true/false state.
|
Method Attributes | Method Name and Description |
---|---|
getState(constraint)
Returns the enabled/disabled state of a constraint
|
|
<inner> |
registerConstraint(constraint)
Register a constraint.
|
setState(constraint, enabled)
Set the enabled/disabled state of a constraint
|
|
subscribe(constraint, callback)
Subscribe to a constraint's state.
|
|
unsubscribe(constraint, callback)
Unsubscribe a callback from a constraint's
state.
|
Class Detail
gui.SessionConstraints()
This class allows handling of 'constraints', which are modelled
as a name (string) with a true/false state.
It provides methods to register, set/get, and subscribe to constraint
states.
Method Detail
{!boolean}
getState(constraint)
Returns the enabled/disabled state of a constraint
- Parameters:
- {!string} constraint
- Returns:
- {!boolean}
<inner>
{undefined}
registerConstraint(constraint)
Register a constraint.
The default state is `false`. Has no effect if the constraint
already exists.
- Parameters:
- {!string} constraint
- Returns:
- {undefined}
{undefined}
setState(constraint, enabled)
Set the enabled/disabled state of a constraint
- Parameters:
- {!string} constraint
- {!boolean} enabled
- true if enabled, false if disabled
- Returns:
- {undefined}
{undefined}
subscribe(constraint, callback)
Subscribe to a constraint's state.
- Parameters:
- {!string} constraint
- {!Function} callback
- the only argument of this callback is a boolean, indicating the new state of the constraint.
- Returns:
- {undefined}
{undefined}
unsubscribe(constraint, callback)
Unsubscribe a callback from a constraint's
state.
- Parameters:
- {!string} constraint
- {!Function} callback
- Returns:
- {undefined}