What is the correct way to get the app instance ($f7) from a helper module?

Since the $f7 var is only available in the component (ex. home.f7.html), what is the correct way to get it from a module file?

Is this the right way to do so? Or is there something easier or better way of getting the app instance?

//my-helper-module.js
export default class Helper {
    showLoginScreen() {
        Framework7.instance.loginScreen.open('#my-login-screen');
    }
}

i have the same question. did you find another simple solution??

In main app file where you init your F7 app (new Framework7), you can just assign it to for example window.f7 = new Framework7 and use it everywhere just as window.f7

1 Like

Every time I try do it this way, I see the f7 object when I console.log(window) and expand, but console.log(window.f7) is always undefined.

Is there a better way to get a handle on the app instance?

If it is undefined, i guess you try to access it before you assign window.f7