Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: grevory/angular-local-storage
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.5.0
Choose a base ref
...
head repository: grevory/angular-local-storage
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.5.2
Choose a head ref
  • 8 commits
  • 6 files changed
  • 3 contributors

Commits on Aug 29, 2016

  1. Copy the full SHA
    eecffdc View commit details

Commits on Sep 21, 2016

  1. Copy the full SHA
    16f6f26 View commit details
  2. Merge pull request #332 from peakon/fix-330

    Add string check to storage change callback key, fixes #330
    grevory authored Sep 21, 2016
    Copy the full SHA
    8c30084 View commit details
  3. 0.5.1

    grevory committed Sep 21, 2016
    Copy the full SHA
    891beb6 View commit details
  4. Deploy PR #332

    grevory committed Sep 21, 2016
    Copy the full SHA
    ba8e79e View commit details

Commits on Sep 27, 2016

  1. Fix #331

    bruceCzK committed Sep 27, 2016
    Copy the full SHA
    a32ca28 View commit details

Commits on Sep 28, 2016

  1. Copy the full SHA
    8cd0b67 View commit details
  2. 0.5.2

    grevory committed Sep 28, 2016
    Copy the full SHA
    2081488 View commit details
Showing with 33 additions and 11 deletions.
  1. +7 −5 dist/angular-local-storage.js
  2. +2 −2 dist/angular-local-storage.min.js
  3. +1 −1 dist/angular-local-storage.min.js.map
  4. +1 −1 package.json
  5. +4 −2 src/angular-local-storage.js
  6. +18 −0 test/spec/localStorageSpec.js
12 changes: 7 additions & 5 deletions dist/angular-local-storage.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* An Angular module that gives you access to the browsers local storage
* @version v0.4.0 - 2016-08-26
* @version v0.5.1 - 2016-09-27
* @link https://github.com/grevory/angular-local-storage
* @author grevory <greg@gregpike.ca>
* @license MIT License, http://www.opensource.org/licenses/MIT
@@ -11,6 +11,7 @@ var isDefined = angular.isDefined,
isNumber = angular.isNumber,
isObject = angular.isObject,
isArray = angular.isArray,
isString = angular.isString,
extend = angular.extend,
toJson = angular.toJson;

@@ -412,7 +413,8 @@ angular
if (thisCookie.indexOf(deriveQualifiedKey(key) + '=') === 0) {
var storedValues = decodeURIComponent(thisCookie.substring(prefix.length + key.length + 1, thisCookie.length));
try {
return JSON.parse(storedValues);
var parsedValue = JSON.parse(storedValues);
return typeof(parsedValue) === 'number' ? storedValues : parsedValue;
} catch(e) {
return storedValues;
}
@@ -477,13 +479,13 @@ angular
if ($window.addEventListener) {
$window.addEventListener("storage", handleStorageChangeCallback, false);
$rootScope.$on('$destroy', function() {
$window.removeEventListener("storage", handleStorageChangeCallback);
$window.removeEventListener("storage", handleStorageChangeCallback);
});
} else if($window.attachEvent){
// attachEvent and detachEvent are proprietary to IE v6-10
$window.attachEvent("onstorage", handleStorageChangeCallback);
$rootScope.$on('$destroy', function() {
$window.detachEvent("onstorage", handleStorageChangeCallback);
$window.detachEvent("onstorage", handleStorageChangeCallback);
});
}
}
@@ -492,7 +494,7 @@ angular
function handleStorageChangeCallback(e) {
if (!e) { e = $window.event; }
if (notify.setItem) {
if (isKeyPrefixOurs(e.key)) {
if (isString(e.key) && isKeyPrefixOurs(e.key)) {
var key = underiveQualifiedKey(e.key);
// Use timeout, to avoid using $rootScope.$apply.
$timeout(function () {
4 changes: 2 additions & 2 deletions dist/angular-local-storage.min.js

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

Loading