moderator-toolbox-nxg-for-reddit / util/infra/platform

util/infra/platform

Functions

getDirectingTo()

getDirectingTo(): { directingTo: string; url: string; } | null

Defined in: extension/data/util/infra/platform.ts:124

Returns the URL and label for the old↔new Reddit toggle button, or null if the button should be hidden.

Returns

{ directingTo: string; url: string; } | null


isUserLoggedInQuick()

isUserLoggedInQuick(): boolean

Defined in: extension/data/util/infra/platform.ts:156

Cheaply tests whether anyone is logged in. We don’t need any details about the account here - only a yes/no before we begin firing API requests for user info and authentication/modhash.

Returns

boolean

Variables

currentPlatform

const currentPlatform: Old | Shreddit | null

Defined in: extension/data/util/infra/platform.ts:14

The Reddit platform detected at page load time, or null if unrecognized.


isEmbedded

const isEmbedded: boolean

Defined in: extension/data/util/infra/platform.ts:33

True when the extension is loaded inside an embedded frame (e.g. the shreddit post-viewer iframe or pages with the embedded-page body class).


isOldReddit

const isOldReddit: boolean

Defined in: extension/data/util/infra/platform.ts:25

True when running on old.reddit.com.


isShreddit

const isShreddit: boolean

Defined in: extension/data/util/infra/platform.ts:27

True when running on the current Reddit redesign (shreddit).

Enumerations

RedditPlatform

Defined in: extension/data/util/infra/platform.ts:6

The Reddit frontends Toolbox can run inside.

Enumeration Members

Old

Old: 0

Defined in: extension/data/util/infra/platform.ts:8

“old Reddit,” old.reddit.com

Shreddit

Shreddit: 1

Defined in: extension/data/util/infra/platform.ts:10

“shreddit” (current Reddit redesign), sh.reddit.com / www.reddit.com