Merge pull request #3412 from m4cx/master

Values in localStorage are not only strings
This commit is contained in:
Masahiro Wakame
2015-01-09 00:34:01 +09:00
2 changed files with 6 additions and 6 deletions

View File

@@ -14,7 +14,7 @@ interface TestScope extends ng.IScope {
module ng.local.storage.tests {
export class TestController {
constructor($scope: TestScope, localStorageService: ng.local.storage.ILocalStorageService) {
constructor($scope: TestScope, localStorageService: ng.local.storage.ILocalStorageService<string>) {
// isSupported
if (localStorageService.isSupported) {
// do something
@@ -72,4 +72,4 @@ app.config(function (localStorageServiceProvider: ng.local.storage.ILocalStorage
.setNotify(true, true);
});
app.controller('TestController', ng.local.storage.tests.TestController);
app.controller('TestController', ng.local.storage.tests.TestController);

View File

@@ -75,7 +75,7 @@ declare module ng.local.storage {
}
interface ILocalStorageService {
interface ILocalStorageService<T> {
/**
* Checks if the browser support the current storage type(e.g: localStorage, sessionStorage).
* Returns: Boolean
@@ -92,14 +92,14 @@ declare module ng.local.storage {
* @param key
* @param value
*/
set(key: string, value: string): boolean;
set(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): string;
get(key: string): T;
/**
* Return array of keys for local storage, ignore keys that not owned.
* Returns: value from local storage
@@ -146,4 +146,4 @@ declare module ng.local.storage {
*/
cookie:ICookie;
}
}
}