View on Github
DarkWiiPlayer/JS
A collection of JavaScript modules to make front-end easier.
Skooma.js
Skooma lets you generate DOM nodes in JavaScript.
Read more
Code Sample:
import {html} from 'skooma.js'
let div = html.div([
html.h1('Hello, World!'),
html.p('Here is some text', {class: ["class_a", "class_b"]})
html.button("Click Me!", { click: event => console.log(event) })
])
Element
A helper function that adds many convenient features to classes for custom elements.
Read More
Code Sample:
import element from 'element.js'
element(class MyElement extends HTMLElement {
static attributes = { foo: true }
fooChanged(oldFoo, newFoo) {
console.log(`Foo changed from ${oldFoo} to ${newFoo}`)
render()
}
$render() { /* ... */ }
})
State
Utility class to monitor state changes on an object using a Proxy and events.
Changes are batched and processed in a microtask.
Read More
const state = new State()
speaker.meepChanged = value => console.log(`meep ${value}`)
state.proxy.meep = "Heat from fire"
state.proxy.meep = "Fire from heat"
state.proxy.meep = "moop"
// outputs: "meep moop"
No, this still has nothing to do with playing audio.
Debounce
Debounces data like user input or events that can occur in a burst.
Read More
Code Sample:
import debounce from 'debounce.js'
input.addEventListener("change", debounce(event => update(input.value)))