Sha256: b110cd6a0076a83e1f8acc4494e60ef12eae8c826ef12d6693142ed8220c90ef
Contents?: true
Size: 797 Bytes
Versions: 7
Compression:
Stored size: 797 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 renderWrapper(): 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
7 entries across 7 versions & 1 rubygems