Constructor
new MemBeanTrainingSession(id, auth)
Begins the training session
Name | Type | Description |
---|---|---|
id | Number | The training session ID |
auth | String | The authentication token |
Methods
(async) advance(advancement, timeOnPageopt) → {Promise.<void>}
Advances the training session
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
advancement | ||||
timeOnPage | Number | <optional> | 5 | The time spent on the page, in seconds |
- Type:
- Promise.<void>
await session.advance(<TODO>, 5);
parseQuiz($) → {MembeanQuizState}
Parses the quiz data from the user state
Name | Type | Description |
---|---|---|
$ | cheerio. | The Cheerio instance |
The parsed quiz data
- Type:
- MembeanQuizState
parseSpellCheck($) → {MembeanSpellTestState}
Parses the spell check data from the user state
Name | Type | Description |
---|---|---|
$ | cheerio. | The Cheerio instance |
The parsed spell check data
- Type:
- MembeanSpellTestState
(async) parseTakeABreak($) → {Object}
Parses the take a break data from the user state, and terminates the session
Name | Type | Description |
---|---|---|
$ | cheerio. | The Cheerio instance |
The parsed take a break data
- Type:
- Object
(async) parseUserState() → {Promise.<void>}
Parses the user state
- Type:
- Promise.<void>
await session.parseUserState();
parseWordLearn($, type) → {MembeanWordLearnState.<("new_word"|"restudy")>}
Parses the word learn data from the user state
Name | Type | Description |
---|---|---|
$ | cheerio. | The Cheerio instance |
type | "new_word" | | The type of word learn, for the emitter |
The parsed word learn data
- Type:
- MembeanWordLearnState.<("new_word"|"restudy")>
Events
new_word
Emitted on a 'new_word' state
- MembeanWordLearnState.<"new_word">
session.on('new_word', (data) => console.log(data));
quiz
Emitted on a 'quiz' state
session.on('quiz', (data) => console.log(data));
restudy
Emitted on a 'restudy' state
- MembeanWordLearnState.<"restudy">
session.on('restudy', (data) => console.log(data));
spelltest
Emitted on a 'spelltest' state
session.on('spelltest', (data) => console.log(data));
take_a_break
Emitted on a 'take_a_break' state
- null
session.on('take_a_break', () => console.log('done'));