Code Monkey home page Code Monkey logo

proxy-storage's People

Contributors

jherax avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

proxy-storage's Issues

Error trying to get an item from storage

When I try to get an existent cookie that has plain text as value, I get the following error:
SyntaxError: Unexpected token l in JSON

const cookieStore = new WebStorage('cookieStorage');

let address = cookieStore.getItem('userAddress')
// throws error

Removing cookies are failing when the domain or path were set in the cookie

When trying to delete a cookie created by setting options.domain or options.path it is not working.

const cookieStore = new WebStorage('cookieStorage');

cookieStore.setItem('testing', [1,4,7], {
  domain: '.wordpress.com',
  expires: { minutes: 10 },
});

cookieStore.getItem('testing'); // ok, it exists
cookieStore.removeItem('testing'); // failing!
cookieStore.getItem('testing'); // failing, still exists!

Storages have no existing elements when they are instantiated the first time

When you create a new instance of a storage mechanism, you don't have access to existing elements, for example:

// previous element
localStorage.setItem('test', "some value");

// create a new instance of the proxy
const localStore = new WebStorage('localStorage');
Object.keys(localStore).forEach((key) => console.log(key, localStore[key]));

Expected: "test" "some value", but got undefined

Getting an error when retrieving nonexistent item from cookieStorage

When I try to retrieve a value that not exist in the cookies store, i get the following error:

Uncaught SyntaxError: Unexpected token u in JSON at position 0...

For example:

var cookieStore = new proxyStorage.WebStorage("cookieStorage");
cookieStore.getItem('nothing-here');

// expected: null
// got: an exception

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.