Accessing app instance from function called by fw7 on-init event handler

[...]
on: {
    init: function () {
      var f7 = this;
      if (f7.device.cordova) {
        // Init cordova APIs (see cordova-app.js)
        cordovaApp.init(f7);
      }
      console.log("init");

      sync();
    },
}
[...]

Inside the sync() function calling app.progressbar.show() throws an error

“Cannot read property ‘progressbar’ of undefined”

. What is the common way of working with this? Thanks in advance!

Framework7.instance.progressbar.show()
1 Like

you can also just pass f7 instance to your sync function:

sync(f7)