0

I use cordova and ripple emulate for debug, all work fine but i i try to change the index.js

var app = {
    // Application Constructor
    initialize: function() {
        this.bindEvents();
    },
bindEvents: function() {
    document.addEventListener("deviceready", this.deviceready, false);
},
    deviceready: function() {
        app.start();
    },
    start: function() {
        //test border
        jQuery("#homePage").css("border","10px solid red");
        navigator.notification.alert(
            "this a test",
            alertCallback,
            "titolo",
            "ok!"
        );
    }
};
function alertCallback(a)
{
    }
jQuery(document).ready(function() {
    app.initialize();
    //console.log("prova");
});

but i try to change

        navigator.notification.alert(
            "hello world",
            alertCallback,
            "titolo",
            "ok!"

grunt reload and ripple show me always the notification "this a test"

why don't change the message??

lbottoni
  • 962
  • 2
  • 14
  • 26
  • other test: also the index.html is not reloaded i Use Firefox and i have turn off the cache offline in about:config – lbottoni Sep 03 '14 at 14:14
  • does your grunt task run `cordova build`? – Dawson Loudon Sep 03 '14 at 16:58
  • Thanks Dawson, but ripple don't build, "ripple" opens a browser on the server for testing. **If I press the "refresh" the browser's text alert will be updated in "hello world"** (_without a build_) So "grunt" gets a reload but does not update "good" – lbottoni Sep 04 '14 at 06:14
  • Into FF: if i press "F5" the message it's always "this a test" but if click on "refresh icon" into address bar, all it's reloaded well and the message is updated ("hello world") really weird :| – lbottoni Sep 04 '14 at 07:13

1 Answers1

0

because i must "prepare" cordova before reload

this is Gruntfile.js that work fine

var     bsoptions={
    //porta di lavoro del livereload standard
    port: 35729,
    //path del nostro tema
    themepath: "./",
    //host inserito nell'installazione di wp
    http_host: "helpdesk.mobile.localhost"
} ;

module.exports = function( grunt ) {
    // inseriamo la configurazione di grunt
    grunt.initConfig({
        //_________________ exec _______________________
        exec:{
            prepare:{
                command:"cordova prepare android",
                stdout:true,
                stderror:true
            }
    },      

    //____________ task "watch" _________
    watch: {
        // dichiariamo quali file deve guardare watch
        scripts:{
            files:[
                '<%= BSbasePath %>/index.html',
                '<%= BSbasePath %>/scripts/index.js'
                ],
            tasks:['exec:prepare']
        },
        //opzioni del task watch
        options: {
            livereload: true,
            keepalive:true,
            spawn: false

        }
    }

});

grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-livereload');
grunt.loadNpmTasks('grunt-exec');

grunt.registerTask('default', function() {
    grunt.task.run([
        //"exec:prepare",
        "watch"
    ]);
});
};
lbottoni
  • 962
  • 2
  • 14
  • 26