UNPKG

kahoot.js-latest

Version:
118 lines (94 loc) 5.91 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JSDoc: Source: modules/questionEnd.js</title> <script src="scripts/prettify/prettify.js"> </script> <script src="scripts/prettify/lang-css.js"> </script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> </head> <body> <div id="main"> <h1 class="page-title">Source: modules/questionEnd.js</h1> <section> <article> <pre class="prettyprint source linenums"><code>/** * @fileinfo This is the questionEnd module * - Loads the QuestionEnd event */ module.exports = function(){ /** * questionEnd - Handles the QuestionEnd event * @param {Object} message The websocket message */ this.handlers.questionEnd = (message)=>{ if(message.channel === "/service/player" &amp;&amp; message.data &amp;&amp; message.data.id === 8){ /** * An event emitted at the end of the question. Contains ranking information. * * @event Client#QuestionEnd * @type {Object} * @property {(Number|Number[]|String)} choice The answer from the client * @property {String} type The question type * @property {Boolean} isCorrect Whether the client answered the question correctly * @property {String} text The text content of correct answers * @property {Number} receivedTime The time (ms) when the answer was received * @property {Booean} pointsQuestion Whether the question offered points * @property {Number} points The amount of points earned from the question * @property {String[]} correctAnswers A list of the text content of the correct answers * @property {Number[]} correctChoices A list of the indexes of correct choices (used in multi select quizzes) * @property {Number} totalScore The total score of the client * @property {Number} rank The current position of the client * @property {PointsData} pointsData Extra information about the points data * @property {Nemesis} nemesis The nemesis */ this._emit("QuestionEnd",JSON.parse(message.data.content)); } }; }; /** * Information about a player one rank above the client. * @namespace Nemesis * @type {Object} * @property {String} name The nemesis's name * @property {Boolean} isGhost Whether the nemesis is a ghost * @property {Number} totalScore The number of points the nemesis has */ /** * Information about the client's points. * @namespace PointsData * @type {Object} * @property {Number} questionPoints The number of points earned from the question * @property {Number} totalPointsWithBonuses The number of points earned (including bonuses) * @property {Number} totalPointsWithoutBonuses The number of points earned without bonuses * @property {StreakPoints} answerStreakPoints Information abuot answer streaks */ /** * Detailed information about the client's answer streaks * @namespace StreakPoints * @type {Object} * @property {Number} streakLevel How many questions were answered correctly in a row. * @property {Number} streakBonus Bonus points awarded by the streakLevel * @property {Number} totalStreakPoints The total streak points earned. * @property {Number} previousStreakLevel The previous steak level * @property {Number} previousStreakBonus The previous streak bonus */ </code></pre> </article> </section> </div> <nav> <h2><a href="index.html">Home</a></h2><h3>Namespaces</h3><ul><li><a href="Client_data.html">data</a></li><li><a href="Client_defaults.html">defaults</a></li><li><a href="Client_defaults.modules.html">modules</a></li><li><a href="Client_defaults.options.html">options</a></li><li><a href="Client_defaults.wsproxy.WsProxyReturn.html">WsProxyReturn</a></li><li><a href="Client_quiz.html">quiz</a></li><li><a href="Client_quiz.currentQuestion.html">currentQuestion</a></li><li><a href="LiveEventTimetrack.html">LiveEventTimetrack</a></li><li><a href="Nemesis.html">Nemesis</a></li><li><a href="PointsData.html">PointsData</a></li><li><a href="StreakPoints.html">StreakPoints</a></li></ul><h3>Classes</h3><ul><li><a href="Client.html">Client</a></li></ul><h3>Events</h3><ul><li><a href="Client.html#event:Disconnect">Disconnect</a></li><li><a href="Client.html#event:Feedback">Feedback</a></li><li><a href="Client.html#event:GameReset">GameReset</a></li><li><a href="Client.html#event:Joined">Joined</a></li><li><a href="Client.html#event:NameAccept">NameAccept</a></li><li><a href="Client.html#event:Podium">Podium</a></li><li><a href="Client.html#event:QuestionEnd">QuestionEnd</a></li><li><a href="Client.html#event:QuestionReady">QuestionReady</a></li><li><a href="Client.html#event:QuestionStart">QuestionStart</a></li><li><a href="Client.html#event:QuizEnd">QuizEnd</a></li><li><a href="Client.html#event:QuizStart">QuizStart</a></li><li><a href="Client.html#event:RecoveryData">RecoveryData</a></li><li><a href="Client.html#event:TeamAccept">TeamAccept</a></li><li><a href="Client.html#event:TeamTalk">TeamTalk</a></li><li><a href="Client.html#event:TimeOver">TimeOver</a></li><li><a href="Client.html#event:TwoFactorCorrect">TwoFactorCorrect</a></li><li><a href="Client.html#event:TwoFactorReset">TwoFactorReset</a></li><li><a href="Client.html#event:TwoFactorWrong">TwoFactorWrong</a></li></ul><h3>Global</h3><ul><li><a href="global.html#EventEmitter">EventEmitter</a></li></ul> </nav> <br class="clear"> <footer> Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.5</a> on Sun Oct 11 2020 19:45:43 GMT-0700 (Pacific Daylight Time) </footer> <script> prettyPrint(); </script> <script src="scripts/linenumber.js"> </script> </body> </html>