Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 12x 10x 10x 12x 12x 12x 36x 36x 36x 23x 4x 4x 4x 23x 19x 19x 19x 23x 12x 12x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 10x 14x 14x 10x 10x 10x 10x 10x 6x 14x 14x 6x 6x 10x 10x 4x 4x 4x 10x 10x 10x 10x 4x 4x 4x 4x 10x 10x | import { render_effect } from '../../../reactivity/effects.js'; /** * @param {'innerHTML' | 'textContent' | 'innerText'} property * @param {HTMLElement} element * @param {() => unknown} get_value * @param {(value: unknown) => void} update * @returns {void} */ export function bind_content_editable(property, element, get_value, update) { element.addEventListener('input', () => { // @ts-ignore update(element[property]); }); render_effect(() => { var value = get_value(); if (element[property] !== value) { if (value === null) { // @ts-ignore var non_null_value = element[property]; update(non_null_value); } else { // @ts-ignore element[property] = value + ''; } } }); } /** * @param {string} property * @param {string} event_name * @param {'get' | 'set'} type * @param {Element} element * @param {() => unknown} get_value * @param {(value: unknown) => void} update * @returns {void} */ export function bind_property(property, event_name, type, element, get_value, update) { var target_handler = () => { // @ts-ignore update(element[property]); }; element.addEventListener(event_name, target_handler); if (type === 'set') { render_effect(() => { // @ts-ignore element[property] = get_value(); }); } if (type === 'get') { // @ts-ignore update(element[property]); } render_effect(() => { // @ts-ignore if (element === document.body || element === window || element === document) { return () => { element.removeEventListener(event_name, target_handler); }; } }); } |