forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
angular-cookie.d.ts
65 lines (54 loc) · 2.05 KB
/
angular-cookie.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// Type definitions for angular-cookie v4.1.0
// Project: https://github.com/ivpusic/angular-cookie
// Definitions by: Borislav Zhivkov <https://github.com/borislavjivkov>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace angular.cookie {
interface CookieService {
/**
* Get all cookies
*/
(): any;
/**
* Get a cookie with a specific key
*/
(key: string): any;
/**
* Create a cookie
*/
(key: string, value: any, options?: CookieOptions): any;
/**
* Remove a cookie
*/
remove(key: string, options?: CookieOptions): void;
}
interface CookieOptions {
/**
* The domain tells the browser to which domain the cookie should be sent. If you don't specify it, it becomes the domain of the page that sets the cookie.
*/
domain?: string;
/**
* The path gives you the chance to specify a directory where the cookie is active.
*/
path?: string;
/**
* Each cookie has an expiry date after which it is trashed. If you don't specify the expiry date the cookie is trashed when you close the browser.
*/
expires?: number;
/**
* Allows you to set the expiration time in hours, minutes, seconds, or `milliseconds. If this is not specified, any expiration time specified will default to days.
*/
expirationUnit?: string;
/**
* The Secure attribute is meant to keep cookie communication limited to encrypted transmission, directing browsers to use cookies only via secure/encrypted connections.
*/
secure?: boolean;
/**
* The method that will be used to encode the cookie value (should be passed when using Set).
*/
encode?: (value: any) => any;
/**
* The method that will be used to decode extracted cookie values (should be passed when using Get).
*/
decode?: (value: any) => any;
}
}