Sha256: 38feadc27ded8f85768bbb8132cff4c4d2cf18f9a455e228a398afa7ba7f08a8
Contents?: true
Size: 790 Bytes
Versions: 17
Compression:
Stored size: 790 Bytes
Contents
import { htmlAttributes } from "../html/html-attributes"; export class Checkbox { state: any; attribute: string; attributes: Record<string, any>; constructor(state: any, attribute: string, attributes: Record<string, any> = {}) { this.state = state; this.attributes = attributes; this.attribute = attribute; this.attributes["data-attribute"] = attribute; } get render(): string { return `<input type='checkbox' ${htmlAttributes(this.attributes)} value='${this.state[this.attribute] || ""}'/>`; } add_action(event: string, klass: string, fn: string, options: { debounce?: number } = {}): Checkbox { this.attributes["data-action"] = `${this.attributes["data-action"] || ""} ${event}->${klass}#${fn}@${options.debounce || 0}`; return this; } }
Version data entries
17 entries across 17 versions & 1 rubygems