I am building a website with the use of phonegap. I ve noticed that bakcbone and jquery -jqm, don't work in the compiled application. Actually, I am receiving in eclipse the following error:
Uncaught ReferenceError: Backbone is not defined at file:///android_asset/www/scripts/JSscript.js:7
Also I am receiving the error:
Uncaught ReferenceError: requestAnimationFrame is not defined at file:///android_asset/www/scripts/JSscript.js:4484
And my touch and click event doesn't function in the extraxted app. Any idea how can I fix this??
JS order:
<script type="text/javascript" src="./scripts/jquery.js"></script>
<script src="http://documentcloud.github.com/underscore/underscore-min.js"></script>
<script src="http://documentcloud.github.com/backbone/backbone-min.js"></script>
<script src='./scripts/JSscript.js'></script>
And JSscript:
var obj;
var profile;
$(function() {
// Backbone model Creation
var ProfileModel = Backbone.Model.extend({
defaults: {
tstamp: 'adffdsa',
map:"",
tagsCloud:"",
sentiment: "",
usersCloud: "",
timeline: "",
highlights: "",
signals: ""
},
initialize: function() {
}
});
//Backbone model initialization
profile = new ProfileModel({
tstamp: 'adffdsa',
map:"",
tagsCloud:"",
sentiment: "",
usersCloud: "",
timeline: "",
highlights: "",
signals: ""
});
var ProfileList = Backbone.Collection.extend({
model: ProfileModel,
url: 'data.php'
});
var ProfileView = Backbone.View.extend({
el: "#profiles",
template: _.template($('#profileTemplate').html()),
render: function(eventName) {
_.each(this.model.models, function(profile){
var profileTemplate = this.template(profile.toJSON());
//push data to obj for map script
obj = profile.toJSON();
// Add data to DOM element
$(this.el).html(profileTemplate);
}, this);
return this;
}
});
var profiles = new ProfileList([profile]);
var profilesView = new ProfileView({model: profiles});
// Fetching data from server every n seconds
setInterval(function() {
profiles.fetch({reset: true});
}, 4000); // Time in milliseconds
profiles.bind('reset', function () {
profilesView.render();
});
});
JSscript.js
? – Adam Botley