Module: actions

Methods

(static) abandon() → {Redux.Thunk}

Represents the user abandoning a link, either by moving their mouse away from it or by shifting focus to another UI element using their keyboard or an assistive device, or abandoning a preview by moving their mouse away from it.

Source:
Returns:
Type
Redux.Thunk

(static) boot(isEnabled, user, userSettings, config, url) → {Object}

Represents Page Previews booting.

When a Redux store is created, the @@INIT action is immediately dispatched to it. To avoid overriding the term, we refer to booting rather than initializing.

Page Previews persists critical pieces of information to local storage. Since reading from and writing to local storage are synchronous, Page Previews is booted when the browser is idle (using mw.requestIdleCallback) so as not to impact latency-critical events.

Parameters:
Name Type Description
isEnabled boolean

See isEnabled.js

user mw.user
userSettings ext.popups.UserSettings
config mw.Map

The config of the MediaWiki client-side application, i.e. mw.config

url string

url

Source:
Returns:
Type
Object

(static) eventLogged(event) → {Object}

Represents the queued event being logged changeListeners/eventLogging.js change listener.

Parameters:
Name Type Description
event Object
Source:
Returns:
Type
Object

(static) fetch(gateway, title, el, token) → {Redux.Thunk}

Represents Page Previews fetching data via the gateway.

Parameters:
Name Type Description
gateway Gateway
title mw.Title
el Element
token string

The unique token representing the link interaction that triggered the fetch

Source:
Returns:
Type
Redux.Thunk

(static) hideSettings() → {Object}

Represents the user closing the settings dialog and saving their settings.

Source:
Returns:
Type
Object

(static) linkClick(el) → {Object}

Represents the user clicking on a link with their mouse, keyboard, or an assistive device.

Parameters:
Name Type Description
el Element
Source:
Returns:
Type
Object

(static) linkDwell(title, el, event, gateway, generateToken) → {Redux.Thunk}

Represents the user dwelling on a link, either by hovering over it with their mouse or by focussing it using their keyboard or an assistive device.

Parameters:
Name Type Description
title mw.Title
el Element
event Event
gateway Gateway
generateToken function
Source:
Returns:
Type
Redux.Thunk

(static) pageviewLogged() → {Object}

Represents the situation when a pageview has been logged (see previewShow and PREVIEW_SEEN action type)

Source:
Returns:
Type
Object

(static) previewDwell() → {Object}

Represents the user dwelling on a preview with their mouse.

Source:
Returns:
Type
Object

(static) previewShow(token) → {Object}

Represents a preview being shown to the user.

This action is dispatched by the ./changeListeners/render.js change listener.

Parameters:
Name Type Description
token string
Source:
Returns:
Type
Object

(static) saveSettings(enabled) → {Redux.Thunk}

Represents the user saving their settings.

N.B. This action returns a Redux.Thunk not because it needs to perform asynchronous work, but because it needs to query the global state for the current enabled state. In order to keep the enabled state in a single place (the preview reducer), we query it and dispatch it as wasEnabled so that other reducers (like settings) can act on it without having to duplicate the enabled state locally. See docs/adr/0003-keep-enabled-state-only-in-preview-reducer.md for more details.

Parameters:
Name Type Description
enabled boolean

if previews are enabled or not

Source:
Returns:
Type
Redux.Thunk

(static) showSettings() → {Object}

Represents the user clicking either the "Enable previews" footer menu link, or the "cog" icon that's present on each preview.

Source:
Returns:
Type
Object

(static) statsvLogged() → {Object}

Represents the queued statsv event being logged. See mw.popups.changeListeners.statsv change listener.

Source:
Returns:
Type
Object

(inner) timedAction(baseAction) → {Object}

Mixes in timing information to an action.

Warning: the baseAction parameter is modified and returned.

Parameters:
Name Type Description
baseAction Object
Source:
Returns:
Type
Object