How to communicate between typescript decorators

Viewed 48

To learn more about decorators I would like to create a decorator which caches the output of a function, something like this

class BarFoo {
    @Cahced()
    doComplexCalc(@CahcedParamIgnore() a, b, c) {

    }
}

DEMO

The @Cached decorator caches the response from doComplexCalc based on the values from a, b and c. As you can see in the example, I would also like to be able to ignore one or more method arguments. My question is, what would be the best way for the @CahcedParamIgnore decorator to inform the @Cached decorator about which arguments to ignore?

0 Answers
Related