2020-06
Meeting Updates
Design Space Updates
Decorators must be static
There is a one-time cost that is paid during parsing or the initial compile.
1. Definition Static
Static through analyzable definition
// tracked.mjs
export decorator @tracked {
@initialize((instance, name, value) => {
instance[`__internal_${name}`] = value;
})
@register((target, name) => {
Object.defineProperty(target, name, {
get() { return this[`__internal_${name}`]; },
set() { this[`__internal_${name}`] = value; this.render(); },
configurable: true
});
})
}
2. Application Static
Static through exactly one meaning applying a decorator
function logged(enabled) {
return () => {
get(target, instance, prop, value) {
return value
},
set(target, instance, prop, value) {
if (enabled)
console.log(prop, value)
return value
}
}
}
3. Build-Target Static
Static through desugaring decorators to a static output via build-tools
Ecosystem Audit