pub fn decorators(c: Config) -> impl Pass
Expand description
§Simple class decorator
@annotation
class MyClass { }
function annotation(target) {
target.annotated = true;
}
§Class decorator
@isTestable(true)
class MyClass { }
function isTestable(value) {
return function decorator(target) {
target.isTestable = value;
}
}
§Class method decorator
class C {
@enumerable(false)
method() { }
}
function enumerable(value) {
return function (target, key, descriptor) {
descriptor.enumerable = value;
return descriptor;
}
}