UNPKG

ziggurat.js

Version:

a tiny modular js library for templates and other shorthands

29 lines (27 loc) 766 B
// Generated by CoffeeScript 2.7.0 // TODO: mirror to cookie, or to local storage // TODO: custom setter for zg.mirror zg.mirror = class { constructor(name, _value) { this.name = name; Object.defineProperty(this, "v", { get: function() { return this._value; }, set: function(val) { var bind, i, len, ref, results; // when V is set, also update the bound valus in HTML this._value = val; ref = zg.queryall(`zg-bind[name=${this.name}]`); results = []; for (i = 0, len = ref.length; i < len; i++) { bind = ref[i]; results.push(bind.innerText = this._value); } return results; } }); // also call the setter this.v = _value; } };