Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F2750908
pageviews.js
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
pageviews.js
View Options
/**
* @module reducers/pageviews
* @private
*/
import
actionTypes
from
'../actionTypes'
;
import
nextState
from
'./nextState'
;
/**
* Reducer for actions that queues and clears events for
* being logged as virtual pageviews [0]
*
* [0]: https://meta.wikimedia.org/wiki/Schema:VirtualPageViews
*
* @param {Object|undefined} state
* @param {Object} action
* @return {Object} The state resulting from reducing the action with the
* current state
*/
export
default
function
pageviews
(
state
,
action
)
{
if
(
state
===
undefined
)
{
state
=
{
pageview
:
undefined
};
}
switch
(
action
.
type
)
{
case
actionTypes
.
BOOT
:
return
nextState
(
state
,
{
page
:
action
.
page
}
);
case
actionTypes
.
PAGEVIEW_LOGGED
:
return
nextState
(
state
,
{
pageview
:
undefined
}
);
case
actionTypes
.
PREVIEW_SEEN
:
return
nextState
(
state
,
{
pageview
:
{
/* eslint-disable camelcase */
page_title
:
action
.
title
,
page_id
:
action
.
pageId
,
page_namespace
:
action
.
namespace
/* eslint-enable camelcase */
}
}
);
default
:
return
state
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-java
Expires
Fri, Jul 3, 17:24 (22 h, 42 m)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
4d/5f/2dbc129604fe38388d2ff8571beb
Default Alt Text
pageviews.js (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment