Class: Quiz

Quiz(questions)

Quiz class

Constructor

new Quiz(questions)

Quiz constructor
Parameters:
Name Type Description
questions Array.<Question> Question list
Source:

Members

answers :Array.<Object>

Type:
  • Array.<Object>
Source:

wrapper :Element

Type:
  • Element
Source:

Methods

addQuestions(…questions) → {Quiz}

Add new questions to the Quiz
Parameters:
Name Type Attributes Description
questions Array.<Question> <repeatable>
Questions to add
Source:
Returns:
The current Quiz
Type
Quiz

attachTo(node) → {Quiz}

Set the Quiz to run inside a DOM Element
Parameters:
Name Type Description
node String | Element The Element to run the Quiz in
Source:
Returns:
The current Quiz
Type
Quiz

offAnswer() → {Quiz}

Remove every onAnswer callback
Source:
Returns:
The current Quiz
Type
Quiz

offEnd() → {Quiz}

Remove every onEnd callback
Source:
Returns:
The current Quiz
Type
Quiz

offTimerStart() → {Quiz}

Remove every onTimerStart callback
Source:
Returns:
The current Quiz
Type
Quiz

onAnswer(callback) → {Quiz}

Add a callback after each user answer
Parameters:
Name Type Description
callback onAnswerCallback
Source:
Returns:
The current Quiz
Type
Quiz

onEnd(callback) → {Quiz}

Add a callback at the end of the Quiz
Parameters:
Name Type Description
callback onEndCallback
Source:
Returns:
The current Quiz
Type
Quiz

onTimerStart(callback) → {Quiz}

Add a callback after each timer start
Parameters:
Name Type Description
callback onTimerStartCallback
Source:
Returns:
The current Quiz
Type
Quiz

removeQuestions(…ids) → {Quiz}

Remove questions from the Quiz
Parameters:
Name Type Attributes Description
ids Array.<String> <repeatable>
Ids of the questions to remove
Source:
Returns:
The current Quiz
Type
Quiz

reset() → {Quiz}

Reset the Quiz to its base form
Source:
Returns:
The current Quiz
Type
Quiz

setTimeLimit(time) → {Quiz}

Set a time limit for each question
Parameters:
Name Type Description
time Number
Source:
Returns:
The current Quiz
Type
Quiz

start(steps) → {Quiz}

Start the Quiz
Parameters:
Name Type Description
steps Number | Array.<Question> The amount of questions to go through OR the list of questions to ask
Source:
Returns:
The current Quiz
Type
Quiz