MCPcopy Create free account
hub / github.com/DavidWells/analytics / context

Function context

packages/analytics-core/src/modules/context.js:46–75  ·  view source on GitHub ↗
(state = initialState, action)

Source from the content-addressed store, hash-verified

44
45// context reducer
46export default function context(state = initialState, action) {
47 const { initialized } = state
48 const { type, campaign } = action
49 switch (type) {
50 case EVENTS.campaign:
51 return {
52 ...state,
53 ...{ campaign: campaign }
54 }
55 case EVENTS.offline:
56 return {
57 ...state,
58 ...{ offline: true }
59 }
60 case EVENTS.online:
61 return {
62 ...state,
63 ...{ offline: false }
64 }
65 default:
66 if (!initialized) {
67 return {
68 ...initialState,
69 ...state,
70 ...{ initialized: true }
71 }
72 }
73 return state
74 }
75}
76
77const excludeItems = ['plugins', 'reducers', 'storage']
78// Pull plugins and reducers off intital config

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected