我使用cordova和ripple模拟进行调试,所有工作正常但我尝试更改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");
});
但我尝试改变
navigator.notification.alert(
"hello world",
alertCallback,
"titolo",
"ok!"
grunt reload and ripple告诉我总是通知"这是一个测试"
为什么不改变信息?
答案 0 :(得分:0)
因为我必须在重装之前“准备”cordova
这是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"
]);
});
};