From b28028ac4082842143b0f528d6bc539da6ccb419 Mon Sep 17 00:00:00 2001 From: Pliable Pixels Date: Thu, 21 Sep 2017 12:49:18 -0400 Subject: mega changes, including updates and X --- www/js/ionicUtils.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 www/js/ionicUtils.js (limited to 'www/js/ionicUtils.js') diff --git a/www/js/ionicUtils.js b/www/js/ionicUtils.js new file mode 100644 index 00000000..c593624c --- /dev/null +++ b/www/js/ionicUtils.js @@ -0,0 +1,32 @@ +/* jshint -W041 */ +/* jshint browser: true*/ +/* global cordova,StatusBar,angular,console */ + +//http://learn.ionicframework.com/formulas/localstorage/ + +angular.module('ionic.utils', []) + +.factory('$localstorage', ['$window', function($window) +{ + return { + + init: function() {}, + + set: function(key, value) + { + $window.localStorage[key] = value; + }, + get: function(key, defaultValue) + { + return $window.localStorage[key] || defaultValue; + }, + setObject: function(key, value) + { + $window.localStorage[key] = JSON.stringify(value); + }, + getObject: function(key) + { + return JSON.parse($window.localStorage[key] || '{}'); + } + }; +}]); -- cgit v1.2.3