Reference · Browser

page_updated

signature
page_updated() -> null

What it does

In the browser, in an event handler, waits until the page shows what the handler has set so far, and gives null. A state set in a handler is shown when the handler lets go; page_updated() lets the handler read the page after it, as focus() on a field that a state just made appear needs. On the server it does nothing.

Examples

in a program
component Search() {    state open = false    state field = null    <div>        <button @click={() => {            open = true            page_updated()               // the input is on the page now            field.focus()        }}>Search</button>        {open && <input @mount={(el) => { field = el }}/>}    </div>}

Edge cases

Errors

It takes nothing; page_updated(1) is an error from quillo check.

Chaining

None: it is a statement in a handler.

See also

run_after, every, js

Thread
1Useful? Like it, or add to its thread below.

Thread 0 posts

On page_updated(): questions, tips, corrections, and code that uses it.

No posts yet. The first one opens the thread.

    Edit this page on GitHub · every example's output was made by running it (tools/refcheck.mjs) · questions on Discord or r/quillo