You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2018/08/23 08:47:17 UTC

[GitHub] kernelfreak opened a new issue #482: Cordova : Nothing in index.js is getting called, no console logs

kernelfreak opened a new issue #482: Cordova : Nothing in index.js is getting called, no console logs
URL: https://github.com/apache/cordova-android/issues/482
 
 
   We are working on a Cordova project where we are developing an app for Android. The app is working good, but for certain functionalities to work properly, we need to access index.js file located in parent-folder/www/js/index.js. We added our modifications there, but nothing from index.js is getting called. We have a simple console.log, which also we don't see. What are we missing?
   
   index.js : 
   ```
   
   var app = {
       // Application Constructor
       initialize: function() {
           document.addEventListener('deviceready', this.onDeviceReady.bind(this), false);
       },
   
       // deviceready Event Handler
       //
       // Bind any cordova events here. Common events are:
       // 'pause', 'resume', etc.
       onDeviceReady: function() {
           console.log("i am so ready for u boyyyzzz!");
           this.receivedEvent('deviceready');
           window.addEventListener("click", function(event){
               var closestA = event.closest("a");
               //if(closestA && closestA.href && (closestA.getAttribute("download") !== undefined) && (closestA.getAttribute("download") !== null)){
                   var fileTransfer = new FileTransfer();
                   var uri = encodeURI(closestA.href);
                   var fileURL =  "///storage/emulated/0/DCIM/myFile";
   
                   fileTransfer.download(
                         uri, fileURL, function(entry) {
                            console.log("download complete: " + entry.toURL());
                         },
   
                         function(error) {
                            console.log("download error source " + error.source);
                            console.log("download error target " + error.target);
                            console.log("download error code" + error.code);
                         }
   
                      );
               //}
           });
       },
   ```
   This is causing us a lot of issues as none of our external functions, especially download seems to be working. What are we doing wrong. Any insight would help, we are stuck on this for 2 days. Thank you. 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org