Skip to content

Loading…

Potential Code optimization for stationsList.js file #41

Open
amobi opened this Issue · 1 comment

2 participants

@amobi

I realize that this is not really a big issue, but by factoring out the repetitive SQL insert statements in the Weather stationsList.js files, this file size could be cut down by approximately 50% i believe. For example:

var stationsList = ["insert into StationList (latitude, longitude, xml_url) values (-22.017, 166.217, 'NWWW');",
"insert into StationList (latitude, longitude, xml_url) values (-21.233, -175.15, 'NFTF');",
........
];

By removing the continuously repeated string in the statement, you can then place it once in the following block:

for (var i=0; i<arrLength; i++) {
tx.executeSql('insert into StationList (latitude, longitude, xml_url) values ('+stationsList[i]+');', null, incrementPercent);
}

The result would be a much smaller file size. As I previously mentioned, this may not be of much importance but it does cut down file size which in my opinion is always a good thing!

@astanley

Great suggestion! I agree - if you can reduce the size of resources without impacting the quality/function of an app - its a win win for everyone.

I've been wanting to see that sample refactored & improved to better support PlayBook & BB10. Your tip should be considered when that work happens (no ETA).

@gmak gmak referenced this issue
Commit has since been removed from the repository and is no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.