Skip to content

Commit

Permalink
Merge pull request #118 from a8m/master
Browse files Browse the repository at this point in the history
fix CI build falling, and broken tests
  • Loading branch information
grevory committed Aug 14, 2014
2 parents b29b896 + 642f1fe commit 64d5bed
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
24 changes: 12 additions & 12 deletions angular-local-storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
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. localStorageServiceProvider.setPrefix('youAppName');
// With provider you can use config as this:
Expand Down Expand Up @@ -65,11 +65,11 @@ angularLocalStorage.provider('localStorageService', function() {


this.$get = ['$rootScope', '$window', '$document', function($rootScope, $window, $document) {

var prefix = this.prefix;
var cookie = this.cookie;
var notify = this.notify;
var storageType = this.storageType;
var self = this;
var prefix = self.prefix;
var cookie = self.cookie;
var notify = self.notify;
var storageType = self.storageType;
var webStorage;

// When Angular's $document is not available
Expand Down Expand Up @@ -110,7 +110,7 @@ angularLocalStorage.provider('localStorageService', function() {
return false;
}
}());



// Directly adds a value to local storage
Expand All @@ -119,7 +119,7 @@ angularLocalStorage.provider('localStorageService', function() {
var addToLocalStorage = function (key, value) {

// If this browser does not support local storage use cookies
if (!browserSupportsLocalStorage || this.storageType === 'cookie') {
if (!browserSupportsLocalStorage || self.storageType === 'cookie') {
$rootScope.$broadcast('LocalStorageModule.notification.warning', 'LOCAL_STORAGE_NOT_SUPPORTED');
if (notify.setItem) {
$rootScope.$broadcast('LocalStorageModule.notification.setitem', {key: key, newvalue: value, storageType: 'cookie'});
Expand All @@ -138,7 +138,7 @@ angularLocalStorage.provider('localStorageService', function() {
}
if (webStorage) {webStorage.setItem(deriveQualifiedKey(key), value)};
if (notify.setItem) {
$rootScope.$broadcast('LocalStorageModule.notification.setitem', {key: key, newvalue: value, storageType: this.storageType});
$rootScope.$broadcast('LocalStorageModule.notification.setitem', {key: key, newvalue: value, storageType: self.storageType});
}
} catch (e) {
$rootScope.$broadcast('LocalStorageModule.notification.error', e.message);
Expand All @@ -151,7 +151,7 @@ angularLocalStorage.provider('localStorageService', function() {
// Example use: localStorageService.get('library'); // returns 'angular'
var getFromLocalStorage = function (key) {

if (!browserSupportsLocalStorage || this.storageType === 'cookie') {
if (!browserSupportsLocalStorage || self.storageType === 'cookie') {
$rootScope.$broadcast('LocalStorageModule.notification.warning','LOCAL_STORAGE_NOT_SUPPORTED');
return getFromCookies(key);
}
Expand Down Expand Up @@ -184,7 +184,7 @@ angularLocalStorage.provider('localStorageService', function() {
try {
webStorage.removeItem(deriveQualifiedKey(key));
if (notify.removeItem) {
$rootScope.$broadcast('LocalStorageModule.notification.removeitem', {key: key, storageType: this.storageType});
$rootScope.$broadcast('LocalStorageModule.notification.removeitem', {key: key, storageType: self.storageType});
}
} catch (e) {
$rootScope.$broadcast('LocalStorageModule.notification.error', e.message);
Expand Down Expand Up @@ -335,7 +335,7 @@ angularLocalStorage.provider('localStorageService', function() {
var cookies = $document.cookie.split(';');
for(var i = 0; i < cookies.length; i++) {
thisCookie = cookies[i];

while (thisCookie.charAt(0) === ' ') {
thisCookie = thisCookie.substring(1, thisCookie.length);
}
Expand Down
2 changes: 1 addition & 1 deletion angular-local-storage.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-local-storage",
"version": "0.0.6",
"version": "0.0.7",
"homepage": "http://gregpike.net/demos/angular-local-storage/demo.html",
"authors": [
"grevory <[email protected]>"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-local-storage",
"version": "0.0.6",
"version": "0.0.7",
"description": "An Angular module that gives you access to the browsers local storage",
"main": "angular-local-storage.js",
"scripts": {
Expand Down

0 comments on commit 64d5bed

Please sign in to comment.