* Update the value in the data model
(newValue: DataValue)
| 115 | * Update the value in the data model |
| 116 | */ |
| 117 | function updateValue(newValue: DataValue): void { |
| 118 | if (!isPath || !path || !context) { |
| 119 | return; |
| 120 | } |
| 121 | |
| 122 | const doUpdate = () => { |
| 123 | if (context.processor.value) { |
| 124 | context.processor.value.setData(context.surfaceId, path, newValue); |
| 125 | } |
| 126 | else if (context.dataModel.value) { |
| 127 | setData(context.dataModel.value, path, newValue); |
| 128 | } |
| 129 | }; |
| 130 | |
| 131 | if (debounceMs > 0) { |
| 132 | if (debounceTimer) { |
| 133 | clearTimeout(debounceTimer); |
| 134 | } |
| 135 | debounceTimer = setTimeout(doUpdate, debounceMs); |
| 136 | } |
| 137 | else { |
| 138 | doUpdate(); |
| 139 | } |
| 140 | } |
| 141 | |
| 142 | return { |
| 143 | value, |
nothing calls this directly
no test coverage detected