You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can also complete a category's data through a question via `Question.category.getData()`
119
118
120
119
```js
121
-
consttargetQuestion= questions[0] // from getQuestions()
120
+
consttargetQuestion= questions[0];// from getQuestions()
122
121
123
122
targetQuestion.category.getData()
124
-
.then(console.log)
123
+
.then(console.log);
125
124
```
126
125
127
126
## Sessions
128
127
A session ensures you are not supplied a question more than once throughout it's lifetime.
129
128
130
129
Initialize a session and supply the instance into `getQuestions()`. Make sure to await or resolve `Session.start()`.
131
130
```js
132
-
import { Session } from"open-trivia-db"
131
+
import { Session } from"open-trivia-db";
133
132
134
133
constmySession=newSession();
135
134
awaitmySession.start();
@@ -139,7 +138,7 @@ getQuestions({
139
138
})
140
139
```
141
140
142
-
`getQuestions()` will return an error once your session has served every single question in OpenTDB. Don't worry, theres thousands of questions! You will likely never come accross a session's end. However, if you wish to reset your session, use `Session.reset()`.
141
+
`getQuestions()` will return an error once your session has served every single question in OpenTDB. Don't worry, there are thousands of questions! You will likely never come accross a session's end. However, if you wish to reset your session, use `Session.reset()`.
0 commit comments