item - Methods - Assess API

Assess API Methods

item()

Retrieves an object containing methods for interacting with a specific Item.

You would want to use this so that you can call Item-level methods after the Item has rendered.

Note This method only returns the methods object when rendering_type is set to assess.

Note The returned object always includes checkImages, flag, and retryLoadImages. It also includes a dynamic method, but only if the Item contains dynamic content.

Examples

assessApp.item("ccore_video_590_classification")
    .checkImages()
    .then(function () {
        console.log("All the images are loaded");
    })
    .catch(function () {
        console.log("Image(s) failed loading. You can call
        `retryLoadImages` on the item facade to retry loading them.");
    });
}

Arguments

  • reference string

    The Item's reference.

Return value

Type object

An object containing methods for an Item when using "assess" as the rendering_type.
  • checkImages function

    Checks whether all images in the Item have loaded; returns a Promise (resolves on success, rejects if any image fails).

  • dynamic object

    Exposes that Item's dynamic-content methods. Present only when the Item contains dynamic content.

  • flag function

    Toggles the Item's flagged state (user_flagged) and fires the item:flag event. Takes no arguments and returns undefined. Calling it on a flagged Item unflags it, and vice versa.

  • retryLoadImages function

    Retries loading images that failed to load.

Was this article helpful?

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