Open
Description
First off, thanks for the project!
Thought I'd share this and hope to make this package typescript friendly. Not sure if this is all that's required to get this working, but it did a lot for me. This assumes that the 'name' option is left at 'ls'. I still had to import like const Storage = require('vue-ls')
- not sure if the fix is with a definitions file or modification of the shipped package.
import _Vue, { PluginFunction } from 'vue';
declare module 'vue/types/vue' {
interface Vue {
$ls: WebStorage;
}
interface VueConstructor {
ls: WebStorage;
}
}
declare class WebStorage {
public length: number;
constructor(storage: Storage);
get(name: string, def?: any): any | null;
set(name: string, value: any, expire?: number): void;
key(index: number): string | null;
remove(name: string): void;
clear(): void;
on(name: string, callback: Function): void;
off(name: string, callback: Function): void;
}
declare interface StorageOptions {
namespace?: string;
name?: string;
storage?: StorageTypes;
}
export enum StorageTypes {
Session = 'session',
Local = 'local',
Memory = 'memory',
}
declare const _default: {
install: PluginFunction<StorageOptions>;
};
export default _default;