Nice idea! Here&#x27;s an alternative which uses ES2016 decorators <a href="https:&#x2F;&#x2F;github.com&#x2F;mgechev&#x2F;aspect.js" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;mgechev&#x2F;aspect.js</a>