Skip to content

Commit

Permalink
Merge pull request #108 from nayarsystems/master
Browse files Browse the repository at this point in the history
Fixed error code on browser platform
  • Loading branch information
GillesC authored Jan 19, 2018
2 parents 801ff3e + 13e68c8 commit 27be91e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions www/LocalStorageHandle.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,27 @@ function LocalStorageHandle(success, error, intent, operation, args) {
try {
var varAsString = JSON.stringify(variable);
if (reference === null) {
error(new NativeStorageError(NativeStorageError.NULL_REFERENCE, "JS", ""));
error(NativeStorageError.NULL_REFERENCE);
return;
}
localStorage.setItem(reference, varAsString);
success(variable);
} catch (err) {
error(new NativeStorageError(NativeStorageError.JSON_ERROR, "JS", err));
error(NativeStorageError.JSON_ERROR);
}
} else if (operation.startsWith('get')) {
var item = {};
item = localStorage.getItem(reference);
if (item === null) {
error(new NativeStorageError(NativeStorageError.ITEM_NOT_FOUND,"JS",""));
error(NativeStorageError.ITEM_NOT_FOUND);
return;
}
try {
var obj = JSON.parse(item);
//console.log("LocalStorage Reading: "+obj);
success(obj);
} catch (err) {
error(new NativeStorageError(NativeStorageError.JSON_ERROR, "JS", err));
error(NativeStorageError.JSON_ERROR);
}
} else if (operation === 'keys') {
var keys = [];
Expand Down

0 comments on commit 27be91e

Please sign in to comment.