OLD | NEW |
1 part of angular.core.dom; | 1 part of angular.core.dom_internal; |
2 | 2 |
3 /** | 3 /** |
4 * This class provides low-level acces to the browser's cookies. | 4 * This class provides low-level acces to the browser's cookies. |
5 * It is not meant to be used directly by applications. Instead | 5 * It is not meant to be used directly by applications. Instead |
6 * use the Cookies service. | 6 * use the Cookies service. |
7 * | 7 * |
8 */ | 8 */ |
9 @NgInjectableService() | 9 @Injectable() |
10 class BrowserCookies { | 10 class BrowserCookies { |
11 ExceptionHandler _exceptionHandler; | 11 ExceptionHandler _exceptionHandler; |
12 dom.Document _document; | 12 dom.Document _document; |
13 | 13 |
14 var lastCookies = {}; | 14 var lastCookies = {}; |
15 var lastCookieString = ''; | 15 var lastCookieString = ''; |
16 var cookiePath; | 16 var cookiePath; |
17 var baseElement; | 17 var baseElement; |
18 | 18 |
19 BrowserCookies(this._exceptionHandler) { | 19 BrowserCookies(this._exceptionHandler) { |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 } | 89 } |
90 } | 90 } |
91 } | 91 } |
92 | 92 |
93 get all => _updateLastCookies(); | 93 get all => _updateLastCookies(); |
94 } | 94 } |
95 | 95 |
96 /** | 96 /** |
97 * Cookies service | 97 * Cookies service |
98 */ | 98 */ |
| 99 @Injectable() |
99 class Cookies { | 100 class Cookies { |
100 BrowserCookies _browserCookies; | 101 BrowserCookies _browserCookies; |
101 Cookies(this._browserCookies); | 102 Cookies(this._browserCookies); |
102 | 103 |
103 /** | 104 /** |
104 * Returns the value of given cookie key | 105 * Returns the value of given cookie key |
105 */ | 106 */ |
106 operator[](name) => this._browserCookies[name]; | 107 operator[](name) => this._browserCookies[name]; |
107 | 108 |
108 /** | 109 /** |
109 * Sets a value for given cookie key | 110 * Sets a value for given cookie key |
110 */ | 111 */ |
111 operator[]=(name, value) => this._browserCookies[name] = value; | 112 operator[]=(name, value) => this._browserCookies[name] = value; |
112 | 113 |
113 /** | 114 /** |
114 * Remove given cookie | 115 * Remove given cookie |
115 */ | 116 */ |
116 remove(name) => this._browserCookies[name] = null; | 117 remove(name) => this._browserCookies[name] = null; |
117 } | 118 } |
118 | 119 |
OLD | NEW |