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

Storage option #60

Closed
MuhammadJamaluddin opened this issue Oct 9, 2020 · 6 comments
Closed

Storage option #60

MuhammadJamaluddin opened this issue Oct 9, 2020 · 6 comments

Comments

@MuhammadJamaluddin
Copy link

What about adding a configuration option to choose between localStorage & sessionStorage?

@bluebill1049
Copy link
Member

try this following:
setStorageType(widnow.localStorage)

@MuhammadJamaluddin
Copy link
Author

Yeah, it works.
Thanks, @bluebill1049 ... I really appreciate it

@DarkSouls101-zz
Copy link

DarkSouls101-zz commented Oct 15, 2020 via email

@lucastrvsn
Copy link

Sorry to open this again, but can I change to storage to indexeddb or similar? I need to storage some images and localStorage and sessionStorage has smaller storage to doing this.

@bluebill1049
Copy link
Member

not supporting indexdb at the momoment.

@Bessonov
Copy link

but, well, I think an indexeddb adapter should be easy to create:

/** This Web Storage API interface provides access to a particular domain's session or local storage. It allows, for example, the addition, modification, or deletion of stored data items. */
interface Storage {
    /**
     * Returns the number of key/value pairs currently present in the list associated with the object.
     */
    readonly length: number;
    /**
     * Empties the list associated with the object of all key/value pairs, if there are any.
     */
    clear(): void;
    /**
     * Returns the current value associated with the given key, or null if the given key does not exist in the list associated with the object.
     */
    getItem(key: string): string | null;
    /**
     * Returns the name of the nth key in the list, or null if n is greater than or equal to the number of key/value pairs in the object.
     */
    key(index: number): string | null;
    /**
     * Removes the key/value pair with the given key from the list associated with the object, if a key/value pair with the given key exists.
     */
    removeItem(key: string): void;
    /**
     * Sets the value of the pair identified by key to value, creating a new key/value pair if none existed for key previously.
     * 
     * Throws a "QuotaExceededError" DOMException exception if the new value couldn't be set. (Setting could fail if, e.g., the user has disabled storage for the site, or if the quota has been exceeded.)
     */
    setItem(key: string, value: string): void;
    [name: string]: any;
}

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

No branches or pull requests

5 participants