xmlplus
Version:
A JavaScript framwork for developing projects efficiently.
22 lines • 870 B
JavaScript
xmlplus("xp", function (xp, $_) {
$_().imports({
Index: {
xml: "<Input placeholder='please input' value='hello world'/>"
},
Input: {
xml: "<input id='input' type='text'/>",
opt: { format: 'string' },
map: { attrs: { input: "disabled value placeholder readonly" } },
fun: function (sys, items, opts) {
var parse = {"int": parseInt, "float": parseFloat, "string": String}[opts.format];
function getValue() {
return parse(sys.input.prop("value"));
}
function setValue(value) {
sys.input.prop("value", parse(value));
}
return Object.defineProperty({}, "val", { get: getValue, set: setValue });
}
}
});
});