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

Function queueReducer

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

Source from the content-addressed store, hash-verified

10}
11
12export default function queueReducer(state = initialState, action) {
13 const { type, payload } = action
14
15 switch (type) {
16 case 'queue':
17 let actionChain
18 /* prioritize identify in event queue */
19 if (payload && payload.type && payload.type === EVENTS.identify) {
20 actionChain = [action].concat(state.actions)
21 } else {
22 actionChain = state.actions.concat(action)
23 }
24 return {
25 ...state,
26 actions: actionChain
27 }
28 case 'dequeue':
29 return []
30 // todo push events to history
31 default:
32 return state
33 }
34}
35
36export const queueAction = (data, timestamp) => {
37 return {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected