Global

Members


<constant> ERROR_CONTEXTS :string

Error Contexts

Type:
  • string
Properties:
Name Type Default Description
load string load

An error that occurred before the candidate can start the assessment

saveSolution string saveSolution

A repeated error saving the solution

submitSolution string submitSolution

A repeated error submitting a project challenge solution

submitAssessment string submitAssessment

A repeated error submitting the entire assessment


<constant> TAB_IDS :string

List of common tab names. For project challenges, this will also include all readwrite enabled file paths.

Type:
  • string
Properties:
Name Type Default Description
code string code

Solution code. Only used for classic code challenges, use file paths for project challenges.

testcases string testcases

Editable test cases for the candidate. Only used for classic code challenges, use file paths for project challenges. Hiding this also disables candidate tests.

instructions string instructions

The instructions created within the challenge editor.

runnerframe string runnerframe

The results from running the challenge. Hiding this tab disables running any sort of code.

webpreview string webpreview

Shows a real-time, embedded web preview for project challenges with web previews enabled.

webpreviewconsole string webpreviewconsole

The console for the web preview. By default, this will not open unless the console logs button is clicked in the web preview. If you want to force it to be opened when the embed is loaded, use initialLayout to position it.

idesettings string idesettings

Enables the code solver to modify the editor. Changes will be synced across embeds on the page.

Methods


obfuscateId(objectID)

Obfuscates a Mongo-DB ObjectID in several steps:

  1. The hex string is converted into a binary string by taking 2 hex characters, converting them to an integer, and getting the charCode for that integer
  2. The resulting binary string is base64 encoded using btoa
  3. We swap out the unsafe base 64 characters (/, +, =) with URL-safe ones.

WARNING: this is only designed to work on ObjectID strings--it expects the string to match /[a-fA-F0-9]/ and have an even number of characters. Odd character counts will break. This input is NOT validated.

Parameters:
Name Type Description
objectID string

ObjectID as a string to convert. Should match /[a-fA-F0-9]{24}/. This input is NOT validated.

Returns:

Obfuscated ID.

Type
string

deobfuscateId(obfuscatedId)

Reverses an obfuscation performed by obfuscateId.

Parameters:
Name Type Description
obfuscatedId string

Obfuscated string. Should match /^[-_~a-zA-Z0-9]+$/. The input is not validated, and could throw if it contains invalid characters.

Returns:

Original ID as a hexadecimal string

Type
string