Sunday, June 3, 2012

Calculator Updated

I made a few fixes to JQM Calculator. All of the modifications were made to the JavaScript file, app.js.

The first bug revealed itself after I ported the app to PhoneGap. During testing on both my iPhone and Nexus One, it was unacceptably sluggish. After spending sometime analyzing the code I realized that I had neglected to put an "event.preventDefault()" in the event handler. This is something I normally do automatically when I don't want the system event handler to take care of things. For unknown reasons, in PhoneGap, this causes extreme performance degradation.


Next there were problems with the input code in RocknCoder.Display. First, it was possible to type more than one decimal point in. And second, there was no upper limit to the number of digits which could be type. I fixed the decimal point bug and set the limit on digits to 20.

Finally, I restored the URL hiding code. I am not in love this implementation, but Android really needs this. So I restored the code to handle it in the RocknCoder.Events function.

The source code is hosted on my GitHub repository: JQMCalculator Source Code


A Live demo of the calculator is at: jQuery Mobile Demos