* Click handler for $list * @this {HTMLElement} * @param {MouseEvent} e
(e)
| 228 | * @param {MouseEvent} e |
| 229 | */ |
| 230 | async function onclick(e) { |
| 231 | const $target = e.currentTarget; |
| 232 | const { key } = $target.dataset; |
| 233 | |
| 234 | const item = itemByKey.get(key); |
| 235 | if (!item) return; |
| 236 | const result = await resolveItemInteraction(item, $target); |
| 237 | if (result.shouldCallCallback === false) { |
| 238 | dispatchItemInteractionEnd($target, false); |
| 239 | return; |
| 240 | } |
| 241 | if (!result.shouldUpdateValue) { |
| 242 | dispatchItemInteractionEnd($target, false); |
| 243 | return callback.call($target, key, item.value); |
| 244 | } |
| 245 | |
| 246 | item.value = result.value; |
| 247 | updateItemValueDisplay($target, item, options, useInfoAsDescription); |
| 248 | dispatchItemInteractionEnd($target, true); |
| 249 | |
| 250 | callback.call($target, key, item.value); |
| 251 | } |
| 252 | } |
| 253 | |
| 254 | function dispatchItemInteractionEnd($target, updated) { |