Skip to main content

Function: answerLessonPage()

function answerLessonPage(
context,
siteUrl,
activityId,
answer,
__namedParameters?
): Promise<{
changed: string;
feedback?: LessonPage;
page: LessonPage;
}>;

Defined in: areas/lessons/lessons.ts:148

Answers the page the person is on: a content page's button (its label or position), or a question's fields by name. Returns Moodle's feedback when it gives one, and the page that follows, going on past the feedback as its "Continue" does; reaching the end ends the attempt. With the realistic trail it first takes the time a reader needs for the page (ADR-005).

Parameters​

ParameterType
contextBrowserContext
siteUrlstring
activityIdnumber
answer{ button?: string | number; responses?: Record<string, string>; }
answer.button?string | number
answer.responses?Record<string, string>
__namedParameters{ onProgress?: (elapsed, total) => void; trail?: "realistic" | "fast"; }
__namedParameters.onProgress?(elapsed, total) => void
__namedParameters.trail?"realistic" | "fast"

Returns​

Promise<{ changed: string; feedback?: LessonPage; page: LessonPage; }>