From c7684b4098da60a75299aa026a443f293c5a57f1 Mon Sep 17 00:00:00 2001 From: Chris Woolum Date: Fri, 17 Apr 2015 11:14:54 -0700 Subject: [PATCH 1/4] 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 --- angular-local-storage/angular-local-storage.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/angular-local-storage/angular-local-storage.d.ts b/angular-local-storage/angular-local-storage.d.ts index d40630a2a..374f57af0 100644 --- a/angular-local-storage/angular-local-storage.d.ts +++ b/angular-local-storage/angular-local-storage.d.ts @@ -75,7 +75,7 @@ declare module angular.local.storage { } - interface ILocalStorageService { + 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(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(key: string): T; /** * Return array of keys for local storage, ignore keys that not owned. * Returns: value from local storage From 9083a5aae05eb3201ba05c9b1e0753134eb04e22 Mon Sep 17 00:00:00 2001 From: Chris Woolum Date: Fri, 17 Apr 2015 11:15:48 -0700 Subject: [PATCH 2/4] Update tests --- angular-local-storage/angular-local-storage-tests.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/angular-local-storage/angular-local-storage-tests.ts b/angular-local-storage/angular-local-storage-tests.ts index cf61d20c9..e9336ac4d 100644 --- a/angular-local-storage/angular-local-storage-tests.ts +++ b/angular-local-storage/angular-local-storage-tests.ts @@ -13,7 +13,7 @@ interface TestScope extends ng.IScope { } export class TestController { - constructor($scope: TestScope, localStorageService: ng.local.storage.ILocalStorageService) { + constructor($scope: TestScope, localStorageService: ng.local.storage.ILocalStorageService) { // isSupported if (localStorageService.isSupported) { // do something @@ -28,7 +28,7 @@ export class TestController { }; // get - $scope.getItem = (key) => { + $scope.getItem = (key : string) => { return localStorageService.get(key); }; From 48208ea21aa41d148e8ae1cc107f512835ac6ebc Mon Sep 17 00:00:00 2001 From: Chris Woolum Date: Fri, 17 Apr 2015 11:18:46 -0700 Subject: [PATCH 3/4] Update contributors list --- CONTRIBUTORS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 1e64d1cad..b54b7d1df 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -30,7 +30,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](angular-bootstrap-lightbox/angular-bootstrap-lightbox.d.ts) [angular-bootstrap-lightbox](https://github.com/compact/angular-bootstrap-lightbox) by [Roland Zwaga](https://github.com/rolandzwaga) * [:link:](angular-hotkeys/angular-hotkeys.d.ts) [angular-hotkeys](https://github.com/chieffancypants/angular-hotkeys) by [Jason Zhao](https://github.com/jlz27), [Stefan Steinhart](https://github.com/reppners) * [:link:](angular-http-auth/angular-http-auth.d.ts) [angular-http-auth](https://github.com/witoldsz/angular-http-auth) by [vvakame](https://github.com/vvakame) -* [:link:](angular-local-storage/angular-local-storage.d.ts) [angular-local-storage](https://github.com/grevory/angular-local-storage) by [Ken Fukuyama](https://github.com/kenfdev) +* [:link:](angular-local-storage/angular-local-storage.d.ts) [angular-local-storage](https://github.com/grevory/angular-local-storage) by [Ken Fukuyama](https://github.com/kenfdev),[Chris Woolum](https://github.com/cwoolum) * [:link:](angular-notify/angular-notify.d.ts) [angular-notify](https://github.com/cgross/angular-notify) by [Suwato](https://github.com/Suwato/DefinitelyTyped) * [:link:](angular-scroll/angular-scroll.d.ts) [angular-scroll](https://github.com/oblador/angular-scroll) by [Sam Herrmann](https://github.com/samherrmann) * [:link:](angular-spinner/angular-spinner.d.ts) [angular-spinner.js](https://github.com/urish/angular-spinner) by [Marcin BiegaƂa](https://github.com/Biegal) From c043b011948321dfb7983e5bb2074eaf38a70aae Mon Sep 17 00:00:00 2001 From: Chris Woolum Date: Fri, 17 Apr 2015 11:23:43 -0700 Subject: [PATCH 4/4] tweak test --- angular-local-storage/angular-local-storage-tests.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/angular-local-storage/angular-local-storage-tests.ts b/angular-local-storage/angular-local-storage-tests.ts index e9336ac4d..230a32dce 100644 --- a/angular-local-storage/angular-local-storage-tests.ts +++ b/angular-local-storage/angular-local-storage-tests.ts @@ -28,8 +28,8 @@ export class TestController { }; // get - $scope.getItem = (key : string) => { - return localStorageService.get(key); + $scope.getItem = (key) => { + return localStorageService.get(key); }; // remove