Player examples
Two ways to feed <astl-player>, both running in this page. Every attribute, property, method and event:
Player reference.
Practice with answers in the page
Section titled “Practice with answers in the page”The exercise of examples/static-html, compiled in this page and graded with localChecker, as astrolabe.js does
it. The log lists the player's events as they happen: answer something, press "Check", go to page 2.
An elephant is
Half of one is
Events, newest first
Backend flow: a view and a checker
Section titled “Backend flow: a view and a checker”Here the page plays only the compiled view, as it would with a server. The checker stands in for the grading
endpoint: under PRACTICE_POLICY the player shows "Check"; under TEST_POLICY it shows "Hand in", the checker
refuses checks, and the result reveals the score only.
The same calls, written out:
// On the server: compile once, keep the key.const result = await engine.compile(source, { salt: 'exercise-42' });
// In the browser, with a real server:// <astl-player src="/v/<viewHash>.html" integrity="<viewHash>" endpoint="/api/attempts/123">// Here, with a checker that grades in the page instead:await player.load({ view: result.view, policy: TEST_POLICY, checker: localChecker(engine, result.key, TEST_POLICY) });