This is a lower-level API. Lower-level APIs are not recommended for most projects, and may not be available on all plans. See our page on recommended deployment patterns for more information.
Public Method Assess API

append()

Append additional questions/features to the desired DOM element. The appended feature and question instances can then be stored and interacted with through feature instance public methods and question instance public methods respectively.

Examples

assessApp.append({
    // optional - if not set, additional questions/features will be appended
    // to the end of assess app's container
    "element": document.querySelector('.additional-widget-wrapper'),

    "features": [{
        "type": "calculator",
        "mode": "basic"
    }],

    "questions": [{
        "type": "plaintext"
    }]
}).then(function (data) {
    // suffixed with 0, 1, ...n if there are many features with the same "type"
    var newCalculatorInstance = data.features['calculator-0'];

    // suffixed with 0, 1, ...n if there are many questions with the same "type"
    var newPlaintextInstance = data.questions['plaintext-0'];

    // User now can interact with appended widgets through their public methods
    // Toggle visibility of current calculator instance
    newCalculatorInstance.toggle();
}).catch(function (error) {
    throw error;
});

Arguments

  • options object
    • element object
      A DOM element into which additional questions/features should be rendered. If no DOM element is provided, the created questions/features will be appended to the end of Assess API's container.
    • features array
      An array of feature configuration objects.
    • questions array
      An array of question configuration objects.

Return value

Value promise

Properties

  • then function
    Takes a success callback function that resolves the promise with an AppendData object as its parameter.
  • catch function
    Takes a rejection callback function that rejects the promise with an error as its parameter.

Type definitions

AppendData object

An object containing question and feature objects that allow access to methods of each newly appended question and feature instance.
  • features AppendDataFeatures
  • questions AppendDataQuestions

AppendDataFeatures object

An object containing feature objects. Each FeatureObject will be prefixed with "[feature type]-[index of feature]", e.g. appendData.features['calculator-0'].

AppendDataQuestions object

Each QuestionJson object will be prefixed with "[question type]-[index of question]", e.g. appendData.questions['shorttext-0'].
Was this article helpful?