Tutoring
The tutoring
object provides methods and properties that can be used in tutoring mode.
1. Methods
⚠️ All
tutoring
methods can only be used when accessing external content registered through the Elice platform's tutoring mode.
getAccountList (Account List)
The getAccountList
method allows you to retrieve the list of accounts enrolled in a course. You can pass the parameters offset
and count
. The offset
indicates the starting position of the account list, and count
indicates the number of accounts to retrieve.
For example, if offset
is 0 and count
is 40, it retrieves the first 40 accounts starting from position 0. To retrieve the next list of accounts, set offset
to 40 and count
to 40. By combining offset
and count
, you can retrieve the account list page by page.
Parameters
Variable | Type | Description |
---|---|---|
offset | number | The starting position of the account list to retrieve. The minimum value is 0. |
count | number | The number of accounts to retrieve. The minimum value is 0, and the maximum value is 40. |
import { eliceContents } from 'src/constants';
const getAccountList = async () => {
const accountList = await eliceContents.tutoring.getAccountList();
console.log(accountList); // [{ fullname: 'elice', uid: 123 }, ...]
};
getAccountKvstore (Account Kvstore)
Use the getAccountKvstore
method to retrieve the learning history of a specific enrolled account.
The required parameters are:
uid
: The unique identifier of the account.key
: The key for the kvstore.
import { eliceContents } from 'src/constants';
const getAccountKvstore = async () => {
const kvstore = await eliceContents.tutoring.getAccountKvstore({
uid: 123,
key: 'quiz01.answer',
});
console.log(kvstore); // 'Elice'
};
2. Properties
isTutoringMode (Tutoring Mode)
⚠️ The
isTutoringMode
property will be removed in version v1.0.0. Instead, please useeliceContents.tutoring.isEnabled
.
import { eliceContents } from 'src/constants';
console.log(eliceContents.isTutoringMode); // false or true
isEnabled (Tutoring Mode Activation Status)
The isEnabled
property is used to check whether tutoring mode is activated. If tutoring mode is active, the value will be true
, and if not, it will be false
.
import { eliceContents } from 'src/constants';
eliceContents.init().then(() => {
console.log(eliceContents.tutoring.isEnabled); // false or true
});
⚠️ Tutoring mode is activated when all of the following conditions are met:
- The user accessed external content registered through the Elice platform's tutoring mode.
- The external content SDK has been initialized.