* Updates the specified property with the provided value and raises a property change event and a specific change event based on the property name.
(name: string, value: any)
| 139 | * Updates the specified property with the provided value and raises a property change event and a specific change event based on the property name. |
| 140 | */ |
| 141 | public setProperty(name: string, value: any): void { |
| 142 | const oldValue = this[name]; |
| 143 | if (this[name] === value) { |
| 144 | return; |
| 145 | } |
| 146 | this[name] = value; |
| 147 | this.notifyPropertyChange(name, value, oldValue); |
| 148 | |
| 149 | const specificPropertyChangeEventName = name + 'Change'; |
| 150 | if (this.hasListeners(specificPropertyChangeEventName)) { |
| 151 | const eventData = this._createPropertyChangeData(name, value, oldValue); |
| 152 | eventData.eventName = specificPropertyChangeEventName; |
| 153 | this.notify(eventData); |
| 154 | } |
| 155 | } |
| 156 | |
| 157 | /** |
| 158 | * Adds a listener for the specified event name. |
no test coverage detected