registerDomElements() {
    var answerContainer = document.createElement('div');
    var libraryPath = getLibraryPath(this.contentId);

    answerContainer.className = styles.answerContainer;

    // Wait for the chart file to load, then do initialization
    getJSON(`${libraryPath}/assets/charts/${this.params.chartType}.json`).then(chart => {
      // Store chart
      this.chart = chart;

      // Attach the component to the container
      let invoiceTypeVisibility = this.params.behaviour.invoiceTypeVisibility;
      let posNegVisibility = this.params.behaviour.posNegVisibility;
      this.answer = new JournalEntryList(chart, false, invoiceTypeVisibility, posNegVisibility);
      this.answer.render(answerContainer);

      // Add the answer to the validator
      this.validator.setAnswer(this.answer);

      // Add 'Check answer' button
      this.addButton('check-answer', l10n.checkAnswer, () => {
        this.hideButton('check-answer');
        this.showButton('show-solution');
        this.showButton('try-again');

        this.setReadonly();
        this.showFeedback();

        // Save the scores using xAPI
        this.triggerXAPIScored(this.getScore(), this.getMaxScore(), 'answered', true, this.getScore() === this.getMaxScore());
      });

      // Add 'Show solution' button
      if (this.params.behaviour.enableSolutionsButton) {
        this.addButton('show-solution', l10n.showSolution, () => {
          this.hideButton('show-solution');

          this.showSolutions();
        }, false);
      }

      // Add 'Retry' button
      if (this.params.behaviour.enableRetry) {
        this.addButton('try-again', l10n.tryAgain, () => {
          this.resetTask();
        }, false);
      }
    });

    // Register Introduction
    this.setIntroduction(this.params.description);

    // Register content
    this.setContent(answerContainer);
  }
/**
   * Register the DOM elements with H5P.Question
   */
Register the DOM elements with H5P.Question
Register the DOM elements with H5P . Question
registerDomElements() {
    var answerContainer = document.createElement('div');
    var libraryPath = getLibraryPath(this.contentId);
    answerContainer.className = styles.answerContainer;
    getJSON(`${libraryPath}/assets/charts/${this.params.chartType}.json`).then(chart => {
      this.chart = chart;
      let invoiceTypeVisibility = this.params.behaviour.invoiceTypeVisibility;
      let posNegVisibility = this.params.behaviour.posNegVisibility;
      this.answer = new JournalEntryList(chart, false, invoiceTypeVisibility, posNegVisibility);
      this.answer.render(answerContainer);
      this.validator.setAnswer(this.answer);
      this.addButton('check-answer', l10n.checkAnswer, () => {
        this.hideButton('check-answer');
        this.showButton('show-solution');
        this.showButton('try-again');
        this.setReadonly();
        this.showFeedback();
        this.triggerXAPIScored(this.getScore(), this.getMaxScore(), 'answered', true, this.getScore() === this.getMaxScore());
      });
      if (this.params.behaviour.enableSolutionsButton) {
        this.addButton('show-solution', l10n.showSolution, () => {
          this.hideButton('show-solution');
          this.showSolutions();
        }, false);
      }
      if (this.params.behaviour.enableRetry) {
        this.addButton('try-again', l10n.tryAgain, () => {
          this.resetTask();
        }, false);
      }
    });
    this.setIntroduction(this.params.description);
    this.setContent(answerContainer);
  }
registerDomElements ( ) { var answerContainer = document . createElement ( 'div' ) ; var libraryPath = getLibraryPath ( this . contentId ) ; answerContainer . className = styles . answerContainer ; getJSON ( ` ${ libraryPath } ${ this . params . chartType } ` ) . then ( chart => { this . chart = chart ; let invoiceTypeVisibility = this . params . behaviour . invoiceTypeVisibility ; let posNegVisibility = this . params . behaviour . posNegVisibility ; this . answer = new JournalEntryList ( chart , false , invoiceTypeVisibility , posNegVisibility ) ; this . answer . render ( answerContainer ) ; this . validator . setAnswer ( this . answer ) ; this . addButton ( 'check-answer' , l10n . checkAnswer , ( ) => { this . hideButton ( 'check-answer' ) ; this . showButton ( 'show-solution' ) ; this . showButton ( 'try-again' ) ; this . setReadonly ( ) ; this . showFeedback ( ) ; this . triggerXAPIScored ( this . getScore ( ) , this . getMaxScore ( ) , 'answered' , true , this . getScore ( ) === this . getMaxScore ( ) ) ; } ) ; if ( this . params . behaviour . enableSolutionsButton ) { this . addButton ( 'show-solution' , l10n . showSolution , ( ) => { this . hideButton ( 'show-solution' ) ; this . showSolutions ( ) ; } , false ) ; } if ( this . params . behaviour . enableRetry ) { this . addButton ( 'try-again' , l10n . tryAgain , ( ) => { this . resetTask ( ) ; } , false ) ; } } ) ; this . setIntroduction ( this . params . description ) ; this . setContent ( answerContainer ) ; }
Register the DOM elements with H5P.Question
Register the DOM elements with H5P . Question
// Wait for the chart file to load, then do initialization // Store chart // Attach the component to the container // Add the answer to the validator // Add 'Check answer' button // Save the scores using xAPI // Add 'Show solution' button // Add 'Retry' button // Register Introduction // Register content