From b316f99df4612d7f11b1fb8f4e3ab4024f8a604a Mon Sep 17 00:00:00 2001 From: Stepan Mikhaylyuk Date: Wed, 19 Aug 2015 19:42:30 +0300 Subject: [PATCH 1/2] updated to 1.0.5 version added jsdocs. es6 import added module lscache for es6 import --- lscache/lscache.d.ts | 41 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-) diff --git a/lscache/lscache.d.ts b/lscache/lscache.d.ts index 24c34bd8d..340d54b76 100644 --- a/lscache/lscache.d.ts +++ b/lscache/lscache.d.ts @@ -1,13 +1,48 @@ -// Type definitions for lscache v1.0.2 +// Type definitions for lscache v1.0.5 // Project: https://github.com/pamelafox/lscache // Definitions by: Chris Martinez // Definitions: https://github.com/borisyankov/DefinitelyTyped interface LSCache { + /** + * Stores the value in localStorage. Expires after specified number of minutes. + * @param {string} key + * @param {Object|string} value + * @param {number} time + */ set(key: string, value: any, time?: number): void; + /** + * Retrieves specified value from localStorage, if not expired. + * @param {string} key + * @return {string|Object} + */ get(key: string): any; + /** + * Removes a value from localStorage. + * Equivalent to 'delete' in memcache, but that's a keyword in JS. + * @param {string} key + */ remove(key: string): void; + /** + * Flushes all lscache items and expiry markers without affecting rest of localStorage + */ + flush(): void; + /** + * Flushes expired lscache items and expiry markers without affecting rest of localStorage + */ + flushExpired(): void; + /** + * Appends CACHE_PREFIX so lscache will partition data in to different buckets. + * @param {string} bucket + */ + setBucket(bucket: string); + /** + * Resets the string being appended to CACHE_PREFIX so lscache will use the default storage behavior. + */ + resetBucket(): void; +} +declare module 'lscache' { + var lscache: LSCache; + export = lscache; } - -declare var lscache: LSCache; \ No newline at end of file From 35afc7dc2c61c0ea91b07bf7859488b61d83714b Mon Sep 17 00:00:00 2001 From: Stepan Mikhaylyuk Date: Wed, 19 Aug 2015 19:46:47 +0300 Subject: [PATCH 2/2] minor fix --- lscache/lscache.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lscache/lscache.d.ts b/lscache/lscache.d.ts index 340d54b76..ed5d133a5 100644 --- a/lscache/lscache.d.ts +++ b/lscache/lscache.d.ts @@ -36,12 +36,13 @@ interface LSCache { * Appends CACHE_PREFIX so lscache will partition data in to different buckets. * @param {string} bucket */ - setBucket(bucket: string); + setBucket(bucket: string):void; /** * Resets the string being appended to CACHE_PREFIX so lscache will use the default storage behavior. */ resetBucket(): void; } +declare var lscache:LSCache; declare module 'lscache' { var lscache: LSCache; export = lscache;