UNPKG

2.72 kBTypeScriptView Raw
1// Type definitions for Angular JS (ngCookies module) 1.8
2// Project: http://angularjs.org
3// Definitions by: Diego Vilar <https://github.com/diegovilar>, Anthony Ciccarello <https://github.com/aciccarello>
4// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
5// TypeScript Version: 2.3
6
7declare var _: string;
8export = _;
9
10import * as angular from 'angular';
11
12declare module 'angular' {
13
14 /**
15 * ngCookies module (angular-cookies.js)
16 */
17 namespace cookies {
18
19 /**
20 * CookiesProvider
21 * see https://docs.angularjs.org/api/ngCookies/provider/$cookiesProvider
22 */
23 interface ICookiesProvider {
24 /**
25 * Object containing default options to pass when setting cookies.
26 */
27 defaults: ICookiesOptions;
28 }
29
30 /**
31 * Cookies options
32 * see https://docs.angularjs.org/api/ngCookies/provider/$cookiesProvider#defaults
33 */
34 interface ICookiesOptions {
35 /**
36 * The cookie will be available only for this path and its sub-paths.
37 * By default, this would be the URL that appears in your base tag.
38 */
39 path?: string | undefined;
40 /**
41 * The cookie will be available only for this domain and its sub-domains.
42 * For obvious security reasons the user agent will not accept the cookie if the
43 * current domain is not a sub domain or equals to the requested domain.
44 */
45 domain?: string | undefined;
46 /**
47 * String of the form "Wdy, DD Mon YYYY HH:MM:SS GMT" or a Date object
48 * indicating the exact date/time this cookie will expire.
49 */
50 expires?: string | Date | undefined;
51 /**
52 * The cookie will be available only in secured connection.
53 */
54 secure?: boolean | undefined;
55 /**
56 * Prevents the browser from sending the cookie along with cross-site requests.
57 * Accepts the values "lax" and "strict".
58 */
59 samesite?: string | undefined;
60 }
61
62 /**
63 * CookiesService
64 * see https://docs.angularjs.org/api/ngCookies/service/$cookies
65 */
66 interface ICookiesService {
67 get(key: string): string;
68 getObject(key: string): any;
69 getObject<T>(key: string): T;
70 getAll(): any;
71 put(key: string, value: string, options?: ICookiesOptions): void;
72 putObject(key: string, value: any, options?: ICookiesOptions): void;
73 remove(key: string, options?: ICookiesOptions): void;
74 }
75 }
76}