Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4127453
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
Wed, Aug 19, 08:37 (2 w, 3 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
43/ab/f2071adea5e96d04d83281a05e21
Default Alt Text
pageviews.js (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment