February 2019
Beginner
694 pages
18h 4m
English
Multiple decorators can be applied one after another to the same target. As an example of this, consider the following code:
function secondDecorator(constructor : Function) {
console.log('secondDecorator called.')
}
@simpleDecorator
@secondDecorator
class ClassWithMultipleDecorators {
}
Here, we have created another decorator named secondDecorator, which also simply logs a message to the console. We are then applying both the simpleDecorator (from our earlier code snippet) and the secondDecorator decorators to the class definition of the class named ClassWithMultipleDecorators. The output of this code is as follows:
secondDecorator called. simpleDecorator called.
The output of this code shows us an interesting point ...
Read now
Unlock full access