render_optimization.defer_render - Initialization - Questions API

Questions API Initialization

defer_render

When enabled, supported Questions and Features will only render at runtime if they are actually going to be visible.

If they happen to be in a container that is not yet visible:

  • By default, they will postpone rendering until they are visible in the DOM (i.e. the parent container has become visible); and,
  • If the defer_render.stagger option is also configured, they will render in the background over time so that they will likely all be pre-rendered by the time a user makes them visible.

By spreading out the rendering over time, deferred rendering is most useful for assessments with a large number of Questions and/or Features – especially those with lots of heavy content such as math; i.e. those that require a lot of DOM elements to be rendered. If rendering is not deferred in such cases, it can be a significant strain on the browser when rendering them all at once initially.

Note If the defer_render.stagger option is enabled, the regular deferred rendering behaviour will still continue at the same time, i.e. Questions and Features will render as soon as they become visible even if staggered rendering hasn't gotten to them first.

Supported Questions:

  • Association
  • Chemistry Essay V2
  • Choice Matrix
  • Classification
  • Cloze Association
  • Cloze Dropdown
  • Cloze Text
  • Drawing
  • Formula Essay V2
  • Highlight
  • Image Cloze
  • Image Cloze Association V2
  • Long Text V2
  • Multiple Choice Question
  • Order List
  • Rating
  • Short Text
  • Token Highlight
  • Video

Supported Features:

  • Calculator
  • Image Tool
  • Line Reader
  • Scrollable Passage
  • Video Player

Note Unsupported Questions and Features will always render as normal at runtime, regardless of whether their container is visible or not.

Values

Attribute path render_optimization.defer_render

Default false

  • Type boolean

    Determines whether to enable deferred rendering of Questions and Features.

  • Type object

    Additional options for configuring deferred rendering.

    • stagger boolean

      Enables staggered rendering, whereby hidden Questions and Features are rendered in the background at a configurable interval until completion.

    • stagger_interval number

      The interval in milliseconds between each Question and Feature background render.

      Default: 250

Versioning

Version added:  v2023.2.LTS

Related articles

  • The render question instance public method.
  • The isRendered question instance public method.
  • The rendered question instance event.
  • The render feature instance public method.
  • The isRendered feature instance public method.
  • The rendered feature instance event.
Was this article helpful?

Did you arrive here by accident? If so, learn more about Learnosity.