Skip to content

DOM Manipulation

onready

onready(fn() {
    say("hi")
})

Equivalent to:

document.addEventListener("DOMContentLoaded", function() { console.log("hi"); })

doc.get

val element = doc.get('myId')

Selects an element by ID. Same functionality as const element = document.getElementById('myId').

doc.make

val newElement = doc.make('div')

Creates a new element.

doc.listen

val listener = doc.listen('button')

Equivalent to const listener = document.addEventListener('button').

element.put

parentElement.put(child)

Appends a child element to a parent. Equivalent to parentElement.appendChild(child).

element.listen

element.listen('click', () => {})

Attaches an event listener to an element. Equivalent to element.addEventListener('click', () => { }).