how to migrate app.js that was using methods, helpers and app() to v6 correctly?
import $ from 'dom7';
import Framework7, {
Template7
} from 'framework7/framework7.esm.bundle.js';
import * as MarkerClusterer from "@google/markerclusterer";
Template7.registerHelper('ratingScore', function (reviews, options) {
'use strict';
...
});
// Import F7 Styles
import 'framework7/css/framework7.bundle.css';
// Import Icons and App Custom Styles
import '../css/icons.css';
import '../css/app.scss';
// Import Cordova APIs
import cordovaApp from './cordova-app.js';
// Import Routes
import routes from './routes.js';
// Import main app component
import App from '../app.f7.html';
import i18next from 'i18next';
import Backend from 'i18next-http-backend';
import {
forEach
} from '../template7-helpers-list';
var app = new Framework7({
root: '#app', // App root element
component: App, // App main component
id: 'com.app.app', // App bundle ID
name: 'appname', // App name
theme: 'auto', // Automatic theme detection
view: {
stackPages: true,
//iosDynamicNavbar: false,
//xhrCache: false,
},
lazy: {
threshold: 50,
sequential: false,
},
card: {
backrop: false,
closeByBackdropClick: false,
},
data: function () {
i18next.init({
lng: 'it',
debug: true,
resources: {
en: {
translation: {}
},
es: {
translation: {}
}
},
}
},
function (err, t) {
if (err) return console.log(err);
console.log('i18n initialized!');
});
});
return {
lockLangTo: 'en'
};
},
methods: {
helloWorld: function () {
app.dialog.alert('Hello World!');
},
registerUser: function () {
var self = this;
console.log('registering user...');
},
},
// App routes
routes: routes,
// Input settings
input: {
scrollIntoViewOnFocus: Framework7.device.cordova && !Framework7.device.electron,
scrollIntoViewCentered: Framework7.device.cordova && !Framework7.device.electron,
},
// Cordova Statusbar settings
statusbar: {
iosOverlaysWebView: true,
androidOverlaysWebView: false,
},
on: {
init: function () {
var f7 = this;
if (f7.device.cordova) {
// Init cordova APIs (see cordova-app.js)
cordovaApp.init(f7);
}
},
},
});
var abortController = app.request.abortController();
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
window.open = cordova.InAppBrowser.open;
console.log(navigator.camera);
}
var view = app.views.create('.view-main', {
on: {
pageInit: function () {
console.log('page init')
}
}
})
also need to know how to run methods in app.js in v6
appreciate a lot the support!