Download wp-calypso/client/reader/controller-helper.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.67 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/reader/controller-helper.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/reader/controller-helper.js
-
curl -L -o controller-helper.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/reader/controller-helper.js
1.67 kB
| import i18n from 'i18n-calypso'; | |
| import moment from 'moment'; | |
| import { gaRecordEvent } from 'calypso/lib/analytics/ga'; | |
| import { bumpStat } from 'calypso/lib/analytics/mc'; | |
| import { recordPageView } from 'calypso/lib/analytics/page-view'; | |
| import { recordTrack } from 'calypso/reader/stats'; | |
| import { setDocumentHeadTitle as setTitle } from 'calypso/state/document-head/actions'; | |
| export function trackPageLoad( path, title, readerView ) { | |
| recordPageView( path, title ); | |
| bumpStat( 'reader_views', readerView === 'full_post' ? readerView : readerView + '_load' ); | |
| } | |
| export function getStartDate( context ) { | |
| if ( context.query && context.query.at ) { | |
| const startDate = moment( context.query.at ); | |
| return startDate.isValid() ? startDate.toISOString() : null; | |
| } | |
| return null; | |
| } | |
| export function trackScrollPage( path, title, category, readerView, pageNum ) { | |
| gaRecordEvent( category, 'Loaded Next Page', 'page', pageNum ); | |
| recordTrack( 'calypso_reader_infinite_scroll_performed', { | |
| path: path, | |
| page: pageNum, | |
| section: readerView, | |
| } ); | |
| recordPageView( path, title ); | |
| bumpStat( 'reader_views', readerView + '_scroll' ); | |
| } | |
| export function trackUpdatesLoaded( key ) { | |
| bumpStat( 'reader_views', key + '_load_new' ); | |
| gaRecordEvent( 'Reader', 'Clicked Load New Posts', key ); | |
| recordTrack( 'calypso_reader_load_new_posts', { | |
| section: key, | |
| } ); | |
| } | |
| export function setPageTitle( context, title ) { | |
| // @todo Auto-converted from the setTitle action. Please use <DocumentHead> instead. | |
| context.store.dispatch( | |
| setTitle( | |
| i18n.translate( '%s ‹ Reader', { | |
| args: title, | |
| comment: '%s is the section name. For example: "My Likes"', | |
| } ) | |
| ) | |
| ); | |
| } | |