Skip to content
This repository has been archived by the owner on Mar 8, 2021. It is now read-only.

Commit

Permalink
Fix driver support checking for custom drivers
Browse files Browse the repository at this point in the history
  • Loading branch information
Zach Snow committed Jun 16, 2015
1 parent 43b1a2a commit c9a425d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
12 changes: 6 additions & 6 deletions dist/angular-locker.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@
if (! _defined(this._supported)) {
var l = 'l';
try {
this._resolveDriver(driver || 'local').setItem(l, l);
this._resolveDriver(driver || 'local').removeItem(l);
this._resolveDriver(driver || options.driver).setItem(l, l);
this._resolveDriver(driver || options.driver).removeItem(l);
this._supported = true;
} catch (e) {
this._supported = false;
Expand Down Expand Up @@ -248,7 +248,7 @@
* @param {Mixed} value
*/
this._setItem = function (key, value) {
if (! this._checkSupport()) _error('The browser does not support localStorage');
if (! this._checkSupport()) _error('The browser does not support the "' + options.driver + '" driver');

try {
var oldVal = this._getItem(key);
Expand Down Expand Up @@ -277,7 +277,7 @@
* @return {Mixed}
*/
this._getItem = function (key) {
if (! this._checkSupport()) _error('The browser does not support localStorage');
if (! this._checkSupport()) _error('The browser does not support the "' + options.driver + '" driver');

return this._unserialize(this._driver.getItem(this._getPrefix(key)));
};
Expand All @@ -290,7 +290,7 @@
* @return {Boolean}
*/
this._exists = function (key) {
if (! this._checkSupport()) _error('The browser does not support localStorage');
if (! this._checkSupport()) _error('The browser does not support the "' + options.driver + '" driver');

return this._driver.hasOwnProperty(this._getPrefix(_value(key)));
};
Expand All @@ -303,7 +303,7 @@
* @return {Boolean}
*/
this._removeItem = function (key) {
if (! this._checkSupport()) _error('The browser does not support localStorage');
if (! this._checkSupport()) _error('The browser does not support the "' + options.driver + '" driver');

if (! this._exists(key)) return false;

Expand Down
2 changes: 1 addition & 1 deletion dist/angular-locker.min.js

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

Loading

0 comments on commit c9a425d

Please sign in to comment.