|
|
|
@ -1,15 +1,15 @@
|
|
|
|
|
(function() {
|
|
|
|
|
/* Start angularLocalStorage */
|
|
|
|
|
'use strict';
|
|
|
|
|
var angularLocalStorage = angular.module('LocalStorageModule', []);
|
|
|
|
|
/* Start angularLocalStorage */
|
|
|
|
|
'use strict';
|
|
|
|
|
var angularLocalStorage = angular.module('LocalStorageModule', []);
|
|
|
|
|
|
|
|
|
|
angularLocalStorage.provider('localStorageService', function(){
|
|
|
|
|
// You should set a prefix to avoid overwriting any local storage variables from the rest of your app
|
|
|
|
|
// e.g. angularLocalStorage.constant('prefix', 'youAppName');
|
|
|
|
|
angularLocalStorage.provider('localStorageService', function(){
|
|
|
|
|
// You should set a prefix to avoid overwriting any local storage variables from the rest of your app
|
|
|
|
|
// e.g. angularLocalStorage.constant('prefix', 'youAppName');
|
|
|
|
|
this.prefix = 'ls';
|
|
|
|
|
// Cookie options (usually in case of fallback)
|
|
|
|
|
// expiry = Number of days before cookies expire // 0 = Does not expire
|
|
|
|
|
// path = The web path the cookie represents
|
|
|
|
|
// Cookie options (usually in case of fallback)
|
|
|
|
|
// expiry = Number of days before cookies expire // 0 = Does not expire
|
|
|
|
|
// path = The web path the cookie represents
|
|
|
|
|
this.cookie = {
|
|
|
|
|
expiry: 30,
|
|
|
|
|
path: '/'
|
|
|
|
@ -35,23 +35,13 @@
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
this.$get = ['$rootScope',function($rootScope){
|
|
|
|
|
|
|
|
|
|
var prefix = this.prefix;
|
|
|
|
|
// If there is a prefix set in the config lets use that with an appended period for readability
|
|
|
|
|
//var prefix = angularLocalStorage.constant;
|
|
|
|
|
if (prefix.substr(-1)!=='.') {
|
|
|
|
|
prefix = !!prefix ? prefix + '.' : '';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Checks the browser to see if local storage is supported
|
|
|
|
|
var browserSupportsLocalStorage = function () {
|
|
|
|
|
try {
|
|
|
|
|
return ('localStorage' in window && window.localStorage !== null);
|
|
|
|
|
} catch (e) {
|
|
|
|
|
$rootScope.$broadcast('LocalStorageModule.notification.error',e.message);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Checks the browser to see if local storage is supported
|
|
|
|
|
var browserSupportsLocalStorage = function () {
|
|
|
|
|
try {
|
|
|
|
|