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(initiallyEnabled, 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
initiallyEnabled Object

Allows to disable individual popup types while still showing the footer link

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

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

url string
Source:
Returns:
Type
Object

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

Represents Page Previews fetching data via the gateway.

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

The unique token representing the link interaction that triggered the fetch

type string

One of the previewTypes.TYPE_… constants

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 HTMLAnchorElement
Source:
Returns:
Type
Object

(static) linkDwell(title, el, measures, gateway, generateToken, type) → {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 HTMLAnchorElement
measures ext.popups.Measures
gateway Gateway
generateToken function
type string

One of the previewTypes.TYPE_… constants

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) registerSetting(name, enabled) → {Object}

Registers a page preview setting for anonymous users.

Parameters:
Name Type Description
name string

setting name which is used for storage and deriving associated messages.

enabled boolean

is the feature enabled by default?

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 oldValue 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 Object

Mapping preview type identifiers to boolean flags

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