Class: QualifiedEmbedManager

QualifiedEmbedManager

Manager for embedded Qualified challenges


new QualifiedEmbedManager(config)

Creates a new Qualified Embed Manager

Parameters:
Name Type Description
config Object
Properties
Name Type Argument Description
onLoaded function <nullable>

Callback for when the editor has loaded and is ready for solving. See ChallengeOptions#onLoaded for callback arguments.

onChange function <nullable>

Callback with changes any time an embedded challenge solution is modified. See ChallengeOptions#onChange for callback arguments.

onRun function <nullable>

Callback with the results when any embedded challenge is run against tests. See ChallengeOptions#onRun for callback arguments.

autoCreate boolean | string <nullable>

If truthy, automatically configure any nodes matching the provided selector or [data-qualified-embed] if not a string. When using autoCreate, the challenge ID is found via the node property data-qualified-embed. Additional options can be passed in via challengeOptions.

baseURL string <nullable>

Override the base URL for testing and debugging.

options ChallengeOptions <nullable>

Default options for new editors.

challengeOptions Object <nullable>

Hash of options to be passed in when injecting an editor. The key should be the challenge ID.

Properties
Type Description
ChallengeOptions

Unique options for each challenge.

Classes

QualifiedEmbedManager

Members


editors :Array.<QualifiedEmbeddedEditor>

List of editors created on this manager.

Type:

options :ChallengeOptions

Shared options for new editors

Type:

challengeOptions :Object

Shared options for new editors

Type:
  • Object
Properties:
Name Type Description
challengeId ChallengeOptions

Options to be set when creating an editor using challengeId as a key.

Methods


<static> init(config)

Creates a new Qualified Embed Manager

Parameters:
Name Type Description
config *

Configuration to pass into the manager. See the QualifiedEmbedManager constructor for configuration options.

Returns:

Object that can be used to create, update, and destroy challenge editors

Type
QualifiedEmbedManager

findEditor(searchKeys)

Returns an existing editor via the node OR the challenge ID. If no editor is found, returns false.

Parameters:
Name Type Description
searchKeys Object
Properties
Name Type Argument Description
node HTMLElement <nullable>

Node the editor was created on (preferred).

challengeId string <nullable>

Challenge ID currently in use within an editor.

Returns:

Challenge editor, or false if no editor was found.

Type
QualifiedEmbeddedEditor | boolean

createEditor(config)

Creates or updates a challenge editor. If an existing editor is found via node or challenge ID, then that editor is returned after updating it with any new options and/or the different challenge ID.

Parameters:
Name Type Description
config Object
Properties
Name Type Argument Description
node HTMLElement

DOM node to use as basis for the injection. Will be used directly if an iFrame, otherwise an iFrame will get appended to this node.

challengeId string <nullable>

Challenge ID for this editor. If not provided, will attempt to be found via the node's data-qualified-embed attribute.

options ChallengeOptions <nullable>

Additional options for this editor, mixed with challenge-specific and shared options on the manager object.

Returns:

Existing or newly created challenge editor

Type
QualifiedEmbeddedEditor

updateEditor(config)

Updates an existing challenge editor, looking it up via node or challenge ID.

Parameters:
Name Type Description
config Object
Properties
Name Type Argument Description
node HTMLElement <nullable>

DOM node to use as basis for the injection.

challengeId string <nullable>

Challenge ID currently used on the editor.

options ChallengeOptions <nullable>

Updated options to set on the editor.

Returns:

Challenge editor, or false if no editor was found.

Type
QualifiedEmbeddedEditor | boolean

destroy()

Destroy this manager and all editors and event listeners created through it.