Overview. It is possible to script your own event handlers for the key Tyk events.The JS files are loaded on API reload into the global JSVM. Since you are not using any function closure variables, there is no need to recreate the on and trigger methods each time the Events constructor function is called. Use the prototype property instead: Function Events() this.stack  . Events.prototype stack: null, Constructor: Event, On: function One Solution collect form web for Rivets.