Skip to content

Commit

Permalink
Updated geolocation JavaScript API - it was broken!
Browse files Browse the repository at this point in the history
  • Loading branch information
Fil Maj committed Nov 28, 2009
1 parent 571787f commit 72c71a4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
7 changes: 3 additions & 4 deletions blackberry/framework/src/www/phonegap.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ AddressBook.prototype.chooseContact = function(successCallback, options) {
params = this.formParams(options,params);
PhoneGap.exec("contacts", params);
};
AddressBook.prototype.displayContact = function(successCallback, errorCallback, options) {
AddressBook.prototype.findContacts = function(successCallback, errorCallback, options) {
if (options.nameFilter && options.nameFilter.length > 0) {
var params = ["search"];
params = this.formParams(options,params);
Expand All @@ -228,7 +228,7 @@ AddressBook.prototype.getAllContacts = function(successCallback, errorCallback,
params = this.formParams(options,params);
PhoneGap.exec("contacts", params);
};
AddressBook.prototype.newContact = function(contact, successCallback, errorCallback, options) {
AddressBook.prototype.addContact = function(contact, successCallback, errorCallback, options) {
if (!contact) {
alert("[PhoneGap Error] newContact function not provided with a contact parameter.");
return;
Expand Down Expand Up @@ -417,8 +417,7 @@ Geolocation.prototype.getCurrentPosition = function(successCallback, errorCallba
var delay = 0;
var timer = setInterval(function() {
delay += interval;

if (typeof(dis.lastPosition) == 'object' && dis.lastPosition.timestamp > referenceTime) {
if (dis.lastPosition != null && dis.lastPosition.timestamp > referenceTime) {
successCallback(dis.lastPosition);
clearInterval(timer);
} else if (delay >= timeout) {
Expand Down
3 changes: 1 addition & 2 deletions blackberry/js/geolocation.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ Geolocation.prototype.getCurrentPosition = function(successCallback, errorCallba
var delay = 0;
var timer = setInterval(function() {
delay += interval;

if (typeof(dis.lastPosition) == 'object' && dis.lastPosition.timestamp > referenceTime) {
if (dis.lastPosition != null && dis.lastPosition.timestamp > referenceTime) {
successCallback(dis.lastPosition);
clearInterval(timer);
} else if (delay >= timeout) {
Expand Down

0 comments on commit 72c71a4

Please sign in to comment.