Skip to content

Instantly share code, notes, and snippets.

@phenomnomnominal
Last active May 29, 2019 15:41
Show Gist options
  • Save phenomnomnominal/c471da7243b26d66e159f85db4754238 to your computer and use it in GitHub Desktop.
Save phenomnomnominal/c471da7243b26d66e159f85db4754238 to your computer and use it in GitHub Desktop.
Examples of property and method decorator-like functions
function PropertyDecorator (property) {
// Modify the property in some way:
return property;
}
function MethodDecorator (method) {
// Modify the method in some way:
return method;
}
class MyClass {
PropertyDecorator(myProperty = true);
MethodDecorator(myMethod () {
return this.myProperty;
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment