Sha256: 78221cb7d4a4e1905b8afbb1192e1577e880af68ba9e7d69b9a8019654be4a72
Contents?: true
Size: 616 Bytes
Versions: 89
Compression:
Stored size: 616 Bytes
Contents
export default class { setCookie (cname, cvalue, exdays) { const d = new Date() d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000)) const expires = 'expires=' + d.toUTCString() document.cookie = cname + '=' + cvalue + ';' + expires + ';path=/' } getCookie (cname) { const name = cname + '=' const ca = document.cookie.split(';') for (let i = 0; i < ca.length; i++) { let c = ca[i] while (c.charAt(0) === ' ') { c = c.substring(1) } if (c.indexOf(name) === 0) { return c.substring(name.length, c.length) } } return '' } }
Version data entries
89 entries across 89 versions & 1 rubygems