DRC API
The DRC API is a set of utilities commonly used in plugins and within the client itself.
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
Client.version
string
Client.versionTag
string
Preload [Preload Only]
Utilities on the Preload.
Preload.evalInBrowserContext
function (str: string): void
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
id
is used to specify the HTML ID of the modal.title
is used to specify the title of the modal.content
is used to specify the HTML content.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
parent
, and the element returned.id
is used to specify the HTML ID of the modal.content
is used to specify the content of the modal.content
is used to specify the HTML content of the modal.name
is used to specify the name of the modal, as shown in the side
pane.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
InternalMessaging.sendColourblindChatMessages
function (chatMessages: any): void
InternalMessaging.sendGameChatMessages
function (chatMessages: any): void
EventObject [Preload Only]
HTML element where events will be dispatched.
EventObject
HTMLDivElement
addEventListener
.
Events [Preload Only]
An object containing events dispatched on the EventObject
.
Events.DomContentLoaded
string
DRC.DomContentLoaded
.
Events.DocumentLoaded
string
DRC.DocumentLoaded
.
Events.GameStarted
string
DRC.GameStarted
.
Events.GameEnded
string
DRC.GameEnded
.
Events.GameEvolved
string
DRC.GameEvolved
.
Events.SettingsOpened
string
DRC.SettingsOpened
.
Events.EventsList
An object containing theCustomEvent
s dispatched on EventObject
.
Events.EventsList.DomContentLoaded
CustomEvent
EventObject
. Value is
DRC.DomContentLoaded
.
Events.EventsList.DocumentLoaded
CustomEvent
EventObject
. Value is
DRC.DocumentLoaded
.
Events.EventsList.GameStarted
CustomEvent
EventObject
. Value is
DRC.GameStarted
.
Events.EventsList.GameEnded
CustomEvent
EventObject
. Value is
DRC.GameEnded
.
Events.EventsList.GameEvolved
CustomEvent
EventObject
. Value is
DRC.GameEvolved
.
Events.EventsList.SettingsOpened
CustomEvent
EventObject
. Value is
DRC.SettingsOpened
.Main [Main Only]
Utilities on the Main.
Main.defaultSession
Proxy<session.defaultSession>
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)
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.