Access file DB stored data outside of app.js

amazon-alexa

#1

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…


#2

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;
    // ...
}

#3

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…


#4

Could you please further elaborate?


#5

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