Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove item raises: Object [object Object] has no method 'getItem' #6

Closed
mashpie opened this issue Apr 30, 2011 · 3 comments · Fixed by #7
Closed

remove item raises: Object [object Object] has no method 'getItem' #6

mashpie opened this issue Apr 30, 2011 · 3 comments · Fixed by #7

Comments

@mashpie
Copy link
Contributor

mashpie commented Apr 30, 2011

Please patch the remove call in localStorage:

      // get value
      val = this.store.getItem(key);

local storage remove should read

    remove: function(key, fn, scope) {
      var val;

      // expand key
      key = this.key(key);

      // get value
      val = this.store.getItem(key);

      // delete value
      this.store.removeItem(key);

      if (fn){
          fn.call(scope || this, (val !== null), val);
      }
    } 

instead of

    remove: function(key, fn, scope) {
      var val;

      // expand key
      key = this.key(key);

      // get value
      val = this.getItem(key);

      // delete value
      this.store.removeItem(key);

      if (fn){
          fn.call(scope || this, (val !== null), val);
      }
    } 
@jeremydurham
Copy link
Owner

Could I convince you to fork it, fix it, and send a pull request? If not, I will apply this change today directly and credit you in the readme

@mashpie
Copy link
Contributor Author

mashpie commented May 1, 2011

sure - just thought to make a hint on that minor change... :) is most easy

@mashpie mashpie closed this as completed May 3, 2011
@tushar-singh
Copy link

I couldn't find a release with fixed code. But this helped

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants