Make the methods generic instead of the interface

Making the interface generic limits it to only one data type. By making the get and set methods generic, you can  use multiple data types on the same service
This commit is contained in:
Chris Woolum
2015-04-17 11:14:54 -07:00
parent 52fa2b9ce3
commit c7684b4098
+3 -3
View File
@@ -75,7 +75,7 @@ declare module angular.local.storage {
}
interface ILocalStorageService<T> {
interface ILocalStorageService {
/**
* Checks if the browser support the current storage type(e.g: localStorage, sessionStorage).
* Returns: Boolean
@@ -92,14 +92,14 @@ declare module angular.local.storage {
* @param key
* @param value
*/
set(key: string, value: T): boolean;
set<T>(key: string, value: T): boolean;
/**
* Directly get a value from local storage.
* If local storage is not supported, use cookies instead.
* Returns: value from local storage
* @param key
*/
get(key: string): T;
get<T>(key: string): T;
/**
* Return array of keys for local storage, ignore keys that not owned.
* Returns: value from local storage