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
stringPreload [Preload Only]
Utilities on the Preload.
Preload.evalInBrowserContext
function (str: string): voidstr 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): HTMLDivElementid 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): HTMLDivElementparent, 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): voidEventObject [Preload Only]
HTML element where events will be dispatched.
EventObject
HTMLDivElementaddEventListener.
Events [Preload Only]
An object containing events dispatched on the EventObject.
Events.DomContentLoaded
stringDRC.DomContentLoaded.
Events.DocumentLoaded
stringDRC.DocumentLoaded.
Events.GameStarted
stringDRC.GameStarted.
Events.GameEnded
stringDRC.GameEnded.
Events.GameEvolved
stringDRC.GameEvolved.
Events.SettingsOpened
stringDRC.SettingsOpened.
Events.EventsList
An object containing theCustomEvents dispatched on EventObject.
Events.EventsList.DomContentLoaded
CustomEventEventObject. Value is
DRC.DomContentLoaded.
Events.EventsList.DocumentLoaded
CustomEventEventObject. Value is
DRC.DocumentLoaded.
Events.EventsList.GameStarted
CustomEventEventObject. Value is
DRC.GameStarted.
Events.EventsList.GameEnded
CustomEventEventObject. Value is
DRC.GameEnded.
Events.EventsList.GameEvolved
CustomEventEventObject. Value is
DRC.GameEvolved.
Events.EventsList.SettingsOpened
CustomEventEventObject. 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.