How to add a function to the Jovo object in a Hook and have this inside the method be the Jovo object


#1

I want to create a hook for ‘after.platform.init’ and in the hook add a function foo(value) to the object. In the function, I want to access this.ask or this.$session.$data.

Later in a handler, I want to be able to call the function: this.foo('hello')

Do you have a sample?


#2

Hey @marktucker

Add this to your app.js (or anywhere else in the global context):

Jovo.prototype.foo = function(value: string) {
    this.ask(value);
};