ENGLISH·COURSE API
    Preparing search index...
    • How much of a lesson the learner has watched, as a share of its runtime.

      Parameters

      • positionSeconds: number | null

        The stored position, or null when nothing is saved

      • durationSeconds: number

        The lesson's length; <= 0 is treated as unknown

      Returns number

      A number in [0, 1]; 0 whenever the inputs cannot be divided

      A presentation policy, like isPositionResumable: it exists so a progress bar can be drawn, and deliberately lives outside the hexagon. Range and finiteness of a persisted position are the PlaybackPosition value object's job; this function additionally tolerates whatever a detached player or a hand-edited storage entry hands it, because a bar is never worth a thrown error.

      A lesson with no runtime — every reading lesson — has no watched fraction rather than an infinite one.

      watchedFraction(240, 600); // 0.4
      watchedFraction(700, 600); // 1 — clamped
      watchedFraction(null, 600); // 0