Method
set
(id: string, value: string, domain = '', path = '/')
Source from the content-addressed store, hash-verified
| 59 | } |
| 60 | |
| 61 | public static set(id: string, value: string, domain = '', path = '/') { |
| 62 | if (!CookieStorage.enabled()) { |
| 63 | return; |
| 64 | } |
| 65 | |
| 66 | const expires = new Date(Date.now() + __20years).toUTCString(); |
| 67 | |
| 68 | const entry = `${id}=${value};expires=${expires};domain=${domain};path=${path}`; |
| 69 | |
| 70 | if (CookieStorage.get(id)) { |
| 71 | CookieStorage.delete(id, domain, path); |
| 72 | } |
| 73 | |
| 74 | document.cookie = entry; |
| 75 | } |
| 76 | } |
Tested by
no test coverage detected