Constructor
new Quiz(questions)
Quiz constructor
Parameters:
Name | Type | Description |
---|---|---|
questions |
Array.<Question> | Question list |
Members
answers :Array.<Object>
Type:
- Array.<Object>
wrapper :Element
Type:
- Element
Methods
addQuestions(…questions) → {Quiz}
Add new questions to the Quiz
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
questions |
Array.<Question> |
<repeatable> |
Questions to add |
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 |
Returns:
The current Quiz
- Type
- Quiz
offAnswer() → {Quiz}
Remove every onAnswer callback
Returns:
The current Quiz
- Type
- Quiz
offEnd() → {Quiz}
Remove every onEnd callback
Returns:
The current Quiz
- Type
- Quiz
offTimerStart() → {Quiz}
Remove every onTimerStart callback
Returns:
The current Quiz
- Type
- Quiz
onAnswer(callback) → {Quiz}
Add a callback after each user answer
Parameters:
Name | Type | Description |
---|---|---|
callback |
onAnswerCallback |
Returns:
The current Quiz
- Type
- Quiz
onEnd(callback) → {Quiz}
Add a callback at the end of the Quiz
Parameters:
Name | Type | Description |
---|---|---|
callback |
onEndCallback |
Returns:
The current Quiz
- Type
- Quiz
onTimerStart(callback) → {Quiz}
Add a callback after each timer start
Parameters:
Name | Type | Description |
---|---|---|
callback |
onTimerStartCallback |
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 |
Returns:
The current Quiz
- Type
- Quiz
reset() → {Quiz}
Reset the Quiz to its base form
Returns:
The current Quiz
- Type
- Quiz
setTimeLimit(time) → {Quiz}
Set a time limit for each question
Parameters:
Name | Type | Description |
---|---|---|
time |
Number |
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 |
Returns:
The current Quiz
- Type
- Quiz