Skip to content

Commit

Permalink
Make the methods generic instead of the interface
Browse files Browse the repository at this point in the history
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
  • Loading branch information
cwoolum committed Apr 17, 2015
1 parent 52fa2b9 commit c7684b4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions angular-local-storage/angular-local-storage.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit c7684b4

Please sign in to comment.