MCPcopy Index your code
hub / github.com/Acode-Foundation/Acode / onclick

Function onclick

src/components/settingsPage.js:230–251  ·  view source on GitHub ↗

* Click handler for $list * @this {HTMLElement} * @param {MouseEvent} e

(e)

Source from the content-addressed store, hash-verified

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
254function dispatchItemInteractionEnd($target, updated) {

Callers 1

runActionMethod · 0.50

Calls 2

callMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected