Constructor
Parameters:
Name |
Type |
Attributes |
Default |
Description |
dataObject |
DataObject
|
<optional>
|
null
|
|
options |
Object
|
<optional>
|
|
Properties
Name |
Type |
Attributes |
Default |
Description |
text |
string
|
<optional>
|
''
|
|
|
- Source:
Example
const buttonComponent = new ButtonComponent(undefined, {
text: 'Click me'
})
// Read and set the text
buttonComponent.text // 'Click me'
buttonComponent.text = 'Do it'
buttonComponent.text // 'Do it'
// Listen for the button activation (This is usually what you want)
buttonComponent.addEventListener(ButtonComponent.ActivatedEvent, (eventName) => {
console.log('Button was activated')
})
// Listen for changes to state (You usually want ButtonComponent.ActivatedEvent)
buttonComponent.addEventListener(ButtonComponent.ChangedEvent, (eventName, isDown) => {
console.log('Button is pressed:', isDown)
})