Hello there, I’m trying to add cordova plugin to framework7 app. My app.js is ,
import $$ from 'dom7';
import Framework7 from 'framework7/framework7.esm.bundle.js';
// Import F7 Styles
import 'framework7/css/framework7.bundle.css';
// Import Icons and App Custom Styles
import '../css/app.css';
// 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';
var app = new Framework7({
root: '#app', // App root element
component: App, // App main component
id: 'io.sapora.sapora_lite', // App bundle ID
name: 'Sapora lite', // App name
theme: 'auto', // Automatic theme detection
// 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);
}
},
},
});
function onDeviceReady(){
var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
}
$$(document).on("page:init",'.page[data-name="home"]',function(e,page){
document.addEventListener("deviceready", onDeviceReady, false);
});
function onDeviceReady()
is not firing up.On a closer inspection, i found out that root does not include cordova.js
due to following line in index.html
:-
<% if (process.env.TARGET === 'cordova') { %>
<script src="cordova.js"></script><% } %>
<!-- built script files will be auto injected -->
So i replaced above code with <script src="cordova.js"></script>
on running again, it produces following error in browser(firefox) console.
Loading failed for the <script> with source “http://127.0.0.1:8080/cordova.js”.
My directory structure is;-
What i think is that it is actually happening because i’m using browser for testing the application? What are the software or plugin did you use(if you successfully integrated cordova plugin) when testing your framework7 application?