Last active
May 29, 2019 15:41
-
-
Save phenomnomnominal/c471da7243b26d66e159f85db4754238 to your computer and use it in GitHub Desktop.
Examples of property and method decorator-like functions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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