Access file DB stored data outside of app.js



I am trying to access filedb stored value outside of app.js, the value is available in app.js but when I am calling method from different file value doesn’t exist anymore or not available. I tried adding it under required to give filedb access but still it didn’t show up…


The this context only works inside an intent handler.

Option 1

I’d probably pass the app module data into the function as parameter:

let episode = Player.getLatestEpisode(this.$user.$data.appModule);

And then:

getLatestEpisode: function (app) {
    // ...

Option 2

You could also pass the Jovo this context, the parameter isn’t allowed to be called this then, though:

let episode = Player.getLatestEpisode(this);

And then:

getLatestEpisode: function (jovo) {
    let app = jovo.$user.$data.appModule;
    // ...


Thanks @jan, I am trying to access this under Alexa audio player handler too? i don’t see any call from app.js for ‘AlexaSkill.PlaybackNearlyFinished’ audio player intent. How to pass it there, the options you mentioned is the way i thought so but then realize that i need those under handler too and i was not sure how can i access it there as no visible call from app.js…


Could you please further elaborate?


You can ignore, actually its nothing but different file so its not going to work their too.


Hi, I also wanted to use a helper function to play audio and set user data, and passing Jovo as a parameter seems a bit silly. I imagine there is some way, hopefully with a plugin, to add a this.player property to the Jovo object, with functions that have Jovo as their this context. Then inside the handlers one could use these functions as this.player(). I took a quick look at docs for writing plugins and decided it was too difficult at the moment, as there were so many middlewares that I would have to wrap my head around, but I’d love a point in the right direction for later—like, if this is not possible at all then I won’t spend time on it, or if it is, which middleware I should hook into when writing the plugin.