(fn)
| 89 | * @returns {void} |
| 90 | */ |
| 91 | export function onMount(fn) { |
| 92 | if (component_context === null) { |
| 93 | e.lifecycle_outside_component('onMount'); |
| 94 | } |
| 95 | |
| 96 | if (legacy_mode_flag && component_context.l !== null) { |
| 97 | init_update_callbacks(component_context).m.push(fn); |
| 98 | } else { |
| 99 | user_effect(() => { |
| 100 | const cleanup = untrack(fn); |
| 101 | if (typeof cleanup === 'function') return /** @type {() => void} */ (cleanup); |
| 102 | }); |
| 103 | } |
| 104 | } |
| 105 | |
| 106 | /** |
| 107 | * Schedules a callback to run immediately before the component is unmounted. |
no test coverage detected