Members
-
<constant> ERROR_CONTEXTS :string
-
Error Contexts
Type:
- string
Properties:
Name Type Default Description loadstring load An error that occurred before the candidate can start the assessment
saveSolutionstring saveSolution A repeated error saving the solution
submitSolutionstring submitSolution A repeated error submitting a project challenge solution
submitAssessmentstring 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 codestring code Solution code. Only used for classic code challenges, use file paths for project challenges.
testcasesstring 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.
instructionsstring instructions The instructions created within the challenge editor.
runnerframestring runnerframe The results from running the challenge. Hiding this tab disables running any sort of code.
webpreviewstring webpreview Shows a real-time, embedded web preview for project challenges with web previews enabled.
webpreviewconsolestring 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
initialLayoutto position it.idesettingsstring idesettings Enables the code solver to modify the editor. Changes will be synced across embeds on the page.
Methods
-
_getStorageData(id [, challengeId])
-
Retrieves parsed data from localStorage. If challengeId is provided, retrieves data specifically for that challenge; otherwise, retrieves global data.
Parameters:
Name Type Argument Description id* The identifier for the data in localStorage
challengeIdstring <optional>
<nullable>
Optional identifier for the challenge data to retrieve
Returns:
- The retrieved data, either for the specified challenge or globally
- Type
- *
-
_setStorageData(id, challengeId, data)
-
Saves data to localStorage, optionally namespaced by challengeId.
Parameters:
Name Type Description id* The identifier for the data in localStorage
challengeIdstring The identifier for the challenge data
data* The data to save
-
obfuscateId(objectID)
-
Obfuscates a Mongo-DB ObjectID in several steps:
- 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
- The resulting binary string is base64 encoded using btoa
- 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 objectIDstring 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 obfuscatedIdstring 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
-
_checkDestroyed(manager)
-
Checks if a manager has been destroyed.
Parameters:
Name Type Description manager* The manager to check
Throws:
-
Throws an error if the manager has been destroyed
- Type
- Error
-