Class Decorators
In the example log
is invoked using @
, and passed a string as a parameter, @log()
returns an anonymous function that is the actual decorator.
The decorator function takes a class
, or constructor function (ES5) as an argument. The decorator function then returns a new class construction function that is used whenever World
is instantiated.
This decorator does nothing other than log out its given parameter, and its target
's class name to the console.
Last updated