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