Skip to main content

Class: XapiStubAdapter

Defined in: adapters/xapi-stub.ts:125

The core Tracker contract. Implementations must be idempotent on terminate() and safe to call from any lifecycle event (unload, visibility change).

Implements

Constructors

Constructor

new XapiStubAdapter(activityId, options?): XapiStubAdapter

Defined in: adapters/xapi-stub.ts:138

Parameters

activityId

string

Stable ID for the containing activity. Becomes the xAPI object.id for session-level statements.

options?

XapiStubOptions = {}

Returns

XapiStubAdapter

Properties

activityId

readonly activityId: string

Defined in: adapters/xapi-stub.ts:140

Stable ID for the containing activity. Becomes the xAPI object.id for session-level statements.

Accessors

state

Get Signature

get state(): TrackerState

Defined in: adapters/xapi-stub.ts:255

Read-only snapshot of the tracker's current understanding of lesson state.

Returns

TrackerState

Read-only snapshot of the tracker's current understanding of lesson state.

Implementation of

Tracker.state


statements

Get Signature

get statements(): readonly XapiStatement[]

Defined in: adapters/xapi-stub.ts:266

Immutable snapshot of all statements emitted so far.

Returns

readonly XapiStatement[]

Methods

clearStatements()

clearStatements(): void

Defined in: adapters/xapi-stub.ts:271

Clear the queue. Useful between test cases.

Returns

void


complete()

complete(): Promise<void>

Defined in: adapters/xapi-stub.ts:210

Mark the lesson complete — translated per standard (lesson_status, completion_status, etc.).

Returns

Promise<void>

Implementation of

Tracker.complete


fail()

fail(): Promise<void>

Defined in: adapters/xapi-stub.ts:235

Terminal-fail.

Returns

Promise<void>

Implementation of

Tracker.fail


init()

init(): Promise<boolean>

Defined in: adapters/xapi-stub.ts:153

Establish an LMS connection (or a no-op for unlaunched contexts). Returns true on success.

Returns

Promise<boolean>

Implementation of

Tracker.init


pass()

pass(): Promise<void>

Defined in: adapters/xapi-stub.ts:222

Terminal-pass. complete() is still required separately unless the adapter fuses them.

Returns

Promise<void>

Implementation of

Tracker.pass


recordInteraction()

recordInteraction(interaction): Promise<void>

Defined in: adapters/xapi-stub.ts:179

Parameters

interaction

InteractionResult

Returns

Promise<void>

Implementation of

Tracker.recordInteraction


setBookmark()

setBookmark(bookmark): Promise<void>

Defined in: adapters/xapi-stub.ts:173

Opaque resume location. SCORM 1.2 caps this at ~4 KB; the adapter enforces that cap.

Parameters

bookmark

string

Returns

Promise<void>

Implementation of

Tracker.setBookmark


setProgress()

setProgress(progress): Promise<void>

Defined in: adapters/xapi-stub.ts:161

Progress is a scaled value in [0, 1].

Parameters

progress

number

Returns

Promise<void>

Implementation of

Tracker.setProgress


setScore()

setScore(score): Promise<void>

Defined in: adapters/xapi-stub.ts:199

Parameters

score

Score

Returns

Promise<void>

Implementation of

Tracker.setScore


terminate()

terminate(): Promise<void>

Defined in: adapters/xapi-stub.ts:247

Flush buffered state and close the LMS API connection. Idempotent.

Returns

Promise<void>

Implementation of

Tracker.terminate