2014-09-03 31 views
0

我用科爾多瓦和紋波仿真調試,一切工作正常,但II試圖改變index.js科爾多瓦 - 波動 - 咕嚕liveroload JavaScript的應用程序不刷新

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"); 
}); 

,但我試圖改變

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

咕嚕重載和紋波告訴我始終通知「這一個測試」

爲什麼不更改消息?

+0

其他測試:也index.html的不重裝 我使用Firefox和我有轉離線關閉緩存大約:config – lbottoni 2014-09-03 14:14:29

+0

你的grunt任務運行'cordova build'嗎? – 2014-09-03 16:58:24

+0

謝謝Dawson,但漣漪不建立,「漣漪」打開服務器上的瀏覽器進行測試。 **如果我按「刷新」瀏覽器的文本警報將更新在「你好世界」**(_沒有build_) 所以「咕嚕」獲得重新加載,但不更新「好」 – lbottoni 2014-09-04 06:14:44

回答

0

,因爲我必須「準備」科爾多瓦之前重裝

這是正常工作Gruntfile.js

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" 
    ]); 
}); 
}; 
相關問題