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

Version Path
pg_rails-7.0.8.pre.alpha.47 pg_layout/app/javascript/utils/cookies.js
pg_rails-7.0.8.pre.alpha.46 pg_layout/app/javascript/utils/cookies.js
pg_rails-7.0.8.pre.alpha.45 pg_layout/app/javascript/utils/cookies.js
pg_rails-7.0.8.pre.alpha.44 pg_layout/app/javascript/utils/cookies.js
pg_rails-7.0.8.pre.alpha.43 pg_layout/app/javascript/utils/cookies.js
pg_rails-7.0.8.pre.alpha.42 pg_layout/app/javascript/utils/cookies.js
pg_rails-7.0.8.pre.alpha.41 pg_layout/app/javascript/utils/cookies.js
pg_rails-7.0.8.pre.alpha.40 pg_layout/app/javascript/utils/cookies.js
pg_rails-7.0.8.pre.alpha.39 pg_layout/app/javascript/utils/cookies.js
pg_rails-7.0.8.pre.alpha.38 pg_layout/app/javascript/utils/cookies.js
pg_rails-7.0.8.pre.alpha.37 pg_layout/app/javascript/utils/cookies.js
pg_rails-7.0.8.pre.alpha.36 pg_layout/app/javascript/utils/cookies.js
pg_rails-7.0.8.pre.alpha.35 pg_layout/app/javascript/utils/cookies.js
pg_rails-7.0.8.pre.alpha.34 pg_layout/app/javascript/utils/cookies.js
pg_rails-7.0.8.pre.alpha.33 pg_layout/app/javascript/utils/cookies.js
pg_rails-7.0.8.pre.alpha.32 pg_layout/app/javascript/utils/cookies.js
pg_rails-7.0.8.pre.alpha.31 pg_layout/app/javascript/utils/cookies.js
pg_rails-7.0.8.pre.alpha.30 pg_layout/app/javascript/utils/cookies.js
pg_rails-7.0.8.pre.alpha.29 pg_layout/app/javascript/utils/cookies.js
pg_rails-7.0.8.pre.alpha.28 pg_layout/app/javascript/utils/cookies.js