From 690dcb6d31ff7e5bcca7c2cab43a5e3759bf19a6 Mon Sep 17 00:00:00 2001 From: Dona278 Date: Tue, 20 Jun 2017 14:41:47 +0200 Subject: [PATCH] [angular-local-storage] - Added missing parameter and function to the ILocalStorageServiceProvider * Added missing parameter "secure" to the "setStorageCookie" function * Added missing function "setDefaultToCookie" to the "ILocalStorageServiceProvider" --- .../angular-local-storage-tests.ts | 1 + types/angular-local-storage/index.d.ts | 12 +++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/types/angular-local-storage/angular-local-storage-tests.ts b/types/angular-local-storage/angular-local-storage-tests.ts index ead14e85fb..b3fdde8b9e 100644 --- a/types/angular-local-storage/angular-local-storage-tests.ts +++ b/types/angular-local-storage/angular-local-storage-tests.ts @@ -64,6 +64,7 @@ app.config(function (localStorageServiceProvider: ng.local.storage.ILocalStorage localStorageServiceProvider .setPrefix('myApp') .setStorageType('sessionStorage') + .setDefaultToCookie(false) .setNotify(true, true); }); diff --git a/types/angular-local-storage/index.d.ts b/types/angular-local-storage/index.d.ts index faa99065da..76ab65b1b5 100644 --- a/types/angular-local-storage/index.d.ts +++ b/types/angular-local-storage/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for angular-local-storage v0.1.6 +// Type definitions for angular-local-storage v0.6.0 // Project: https://github.com/grevory/angular-local-storage -// Definitions by: Ken Fukuyama +// Definitions by: Ken Fukuyama , Davide Donadello // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -27,12 +27,18 @@ declare module 'angular' { * @param storageType localstorage or sessionStorage. default: localStorage */ setStorageType(storageType: string): ILocalStorageServiceProvider; + /** + * If localStorage is not supported, the library will default to cookies instead. This behavior can be disabled + * @param shouldDefault default: true + */ + setDefaultToCookie(shouldDefault: boolean): ILocalStorageServiceProvider; /** * Setter for cookie config * @param exp number of days before cookies expire (0 = does not expire). default: 30 * @param path the web path the cookie represents. default: '/' + * @param secure to store cookies as secure. default: false */ - setStorageCookie(exp: number, path: string): ILocalStorageServiceProvider; + setStorageCookie(exp: number, path: string, secure: boolean): ILocalStorageServiceProvider; /** * Set the cookie domain, since this runs inside a the config() block, only providers and constants can be injected. As a result, $location service can't be used here, use a hardcoded string or window.location. * No default value