0.2.0 • Published 2 months ago

@analytics/session-utils v0.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

Session Utilities

A tiny session utility library in 775 bytes.

  • Persisted Sessions - saved as cookie for 30min
    • getSession
    • setSession
  • Tab Sessions - saved until tab/window closed
    • getTabSession
    • setTabSession
  • Page Sessions - saved until page changes
    • getPageSession
    • setPageSession

See live demo.

Example

import { getSession, setSession } from '@analytics/session-utils'

const currentSession = getSession()
console.log('currentSession', currentSession)

// Update session
const newSessionInfo = setSession()
console.log('newSessionInfo', newSessionInfo)

About

┌─────────────────────────────────────────────────────────────────┐
│                        Persisted Session                        │
│                                                                 │
│   ┌──────────────────────────┐    ┌──────────────────────────┐  │
│   │       Tab Session        │    │       Tab Session        │  │
│   │                          │    │                          │  │
│   │  ┌────────────────────┐  │    │  ┌────────────────────┐  │  │
│   │  │    Page Session    │  │    │  │    Page Session    │  │  │
│   │  │                    │  │    │  │                    │  │  │
│   │  │                    │  │    │  │                    │  │  │
│   │  │                    │  │    │  │                    │  │  │
│   │  │                    │  │    │  │                    │  │  │
│   │  │                    │  │    │  │                    │  │  │
│   │  │                    │  │    │  │                    │  │  │
│   │  │                    │  │    │  │                    │  │  │
│   │  │                    │  │    │  │                    │  │  │
│   │  └────────────────────┘  │    │  └────────────────────┘  │  │
│   └──────────────────────────┘    └──────────────────────────┘  │
│                                                                 │
└─────────────────────────────────────────────────────────────────┘
0.2.0

2 months ago

0.1.18

11 months ago

0.1.19

11 months ago

0.1.17

2 years ago

0.1.13

2 years ago

0.1.14

2 years ago

0.1.15

2 years ago

0.1.16

2 years ago

0.1.11

3 years ago

0.1.12

3 years ago

0.1.10

3 years ago

0.1.9

3 years ago

0.1.7

3 years ago

0.1.6

3 years ago

0.1.5

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago