I have encountered an issue while building a jQuery Mobile + PhoneGap app for iOS. The app functions correctly on a web browser, but when bundled with PhoneGap and tested on a phone, it starts to forget JavaScript functions. For instance, panels that should open and close on swipe gestures stop responding after multiple swipes. Even though other buttons work fine, the panel functionality is lost.
Interestingly, on a computer or web app, I can perform swipes endlessly without any freezing issues. Could there be something causing my JavaScript functions to clear out? Should I consider defining them differently?
$(document).on('pageinit', '#page', function() {
$(document).on("swipeleft swiperight", "#page", function(e) {
console.log('swiped!!')
});
});
Any suggestions or ideas regarding this problem?
UPDATE:
It seems that the forgotten function only occurs after consistent back-and-forth swiping around 10 times. If I introduce a short pause between each swipe, approximately 2-3 seconds, the app behaves normally for longer periods. Could it be possible that new swipe events are getting tangled up with older ones, leading to freezing issues? I'm struggling to find a solution to this. Any advice on managing memory in a PhoneGap app's JavaScript would be greatly appreciated.