The API

The DRC API can be accessed in Preload as DRC.* namespace, in Main as DRC.* namespace, and the Preload version exposed in browser context as DRC_API.DRC.* namespace.


Client

Some information on the client.


Client.name

string
Name of the Client. (Deeeep.io Reef Client)

Client.version

string
Semantic version of the client. (<major>.<minor>.<patch>)

Client.versionTag

string
Release tag of the client. (<major>.<minor>.<patch><-alpha/-beta/(none)>)


Preload [Preload Only]

Utilities on the Preload.


Preload.evalInBrowserContext

function (str: string): void
Takes a string and evaluates in the browser context.
Parameter str is used to specify the JavaScript source to be evaluated.


Modal [Preload Only]

Utilities on modals.


Modal.buildModal

function (id: string, title: string, content: string, noOverlay?: boolean): HTMLDivElement
Takes arguments about the modal and returns the modal element.
Parameter id is used to specify the HTML ID of the modal.
Parameter title is used to specify the title of the modal.
Parameter content is used to specify the HTML content.
Parameter noOverlay is used to toggle modal overlay. Set to true to hide overlay.


Modal.buildTab

function (id: string, content: { content: string, name: string }[], parent: HTMLElement): HTMLDivElement
Takes arguments about the tabs and builds a multi-tabbed modal. Tab will automatically be appended to parent, and the element returned.
Parameter id is used to specify the HTML ID of the modal.
Parameter content is used to specify the content of the modal.
- Parameter content is used to specify the HTML content of the modal.
- Parameter name is used to specify the name of the modal, as shown in the side pane.
Parameter parent is used to specify the element the modal is to be appended to.

InternalMessaging [Preload Only]

Internal data transfer used by the Client.


InternalMessaging.sendColourblindNames

function (colourblindNames: any): void
Internal logic on Colourblind Mode names.


InternalMessaging.sendColourblindChatMessages

function (chatMessages: any): void
Internal logic on Colourblind Mode chat messages.


InternalMessaging.sendGameChatMessages

function (chatMessages: any): void
Internal logic on Advanced Profanity Filter.


EventObject [Preload Only]

HTML element where events will be dispatched.


EventObject

HTMLDivElement
The object where custom events will be dispatched and can be listened via addEventListener.


Events [Preload Only]

An object containing events dispatched on the EventObject.


Events.DomContentLoaded

string
A string representing the DomContentLoaded custom event. Value is DRC.DomContentLoaded.

Events.DocumentLoaded

string
A string representing the DocumentLoaded custom event. Value is DRC.DocumentLoaded.

Events.GameStarted

string
A string representing the GameStarted custom event. Value is DRC.GameStarted.

Events.GameEnded

string
A string representing the GameEnded custom event. Value is DRC.GameEnded.

Events.GameEvolved

string
A string representing the GameEvolved custom event. Value is DRC.GameEvolved.

Events.SettingsOpened

string
A string representing the SettingsOpened custom event. Value is DRC.SettingsOpened.


Events.EventsList

An object containing the CustomEvents dispatched on EventObject.


Events.EventsList.DomContentLoaded

CustomEvent
A Custom Event that is dispatched on EventObject. Value is DRC.DomContentLoaded.
Dispatched on DOM content loaded.

Events.EventsList.DocumentLoaded

CustomEvent
A Custom Event that is dispatched on EventObject. Value is DRC.DocumentLoaded.
Dispatched on document load.

Events.EventsList.GameStarted

CustomEvent
A Custom Event that is dispatched on EventObject. Value is DRC.GameStarted.
Dispatched on game start.

Events.EventsList.GameEnded

CustomEvent
A Custom Event that is dispatched on EventObject. Value is DRC.GameEnded.
Dispatched on game end, whether that be quitting or death.

Events.EventsList.GameEvolved

CustomEvent
A Custom Event that is dispatched on EventObject. Value is DRC.GameEvolved.
Dispatched on evolution in-game. Currently buggy, will be fixed in a later update.

Events.EventsList.SettingsOpened

CustomEvent
A Custom Event that is dispatched on EventObject. Value is DRC.SettingsOpened.
Dispatched on Settings modal opened.

Main [Main Only]

Utilities on the Main.


Main.defaultSession

Proxy<session.defaultSession>
This is the output of the electron-better-web-request Node module.
A proxy of the Electron session.defaultSession object.
Patches the webRequest object to allow multiple WebRequest listeners.


WebRequestHandlers [Main Only]

Utility template WebRequest handlers.


WebRequestHandlers.genericAssetswapperHandler

function (redirectTemplate: string, regex: RegExp, name: string, filenameKeys?: string): function(details: Object, callback: Function)
Returns a function that can be directly used as a WebRequest handler.
The returned function matches details.url with the regex regular expression, which should contain a named capture group as specified by filenameKeys to extract the file name. The default value of filenameKeys is "filename". Then, appends the file name to redirectTemplate and performs a HTTP GET request to the specified URL. If received a response with the status 200, call callback with a redirectURL of the new redirect URL. Else, if not successful, redirects back to the original URL.