How to use the @analytics/cookie-utils.removeCookie function in @analytics/cookie-utils

To help you get started, we’ve selected a few @analytics/cookie-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DavidWells / analytics / packages / analytics-util-storage / src / index.js View on Github external
export function removeItem(key, options = {}) {
  if (!key) return false
  const storageType = getStorageType(options)
  if (useLocal(storageType)) {
    /* 1. Try localStorage */
    localStorage.removeItem(key)
    return LOCAL_STORAGE
  } else if (useCookie(storageType)) {
    /* 2. Fallback to cookie */
    removeCookie(key)
    return COOKIE
  }
  /* 3. Fallback to window/global */
  globalContext[key] = null
  return GLOBAL
}