<commit_before>'use strict';

function init() {

  const eventedElementId = 'eventedElement';
  const eventedElement = document.getElementById(eventedElementId);
  const foucTarget = document.getElementsByClassName('no-fouc')[0];

  // Un-hide the page elements now that the DOM has fully rendered
  foucTarget && (foucTarget.className = '');

  // Add the card container listeners, using the necessary event trigger
  document.body.dispatchEvent(new CustomEvent('cardstrap', { detail: '.container'}));

  // Data in detail objects could come from a service endpoint

  eventedElement.dispatchEvent(new CustomEvent('initCard', {
    detail: {
      eventedElem: eventedElementId,
      targetElem: 'div1',
      userId: '3c832cbae883f988cfb877f4322d137c',
      username: 'aaron.kaka',
      bio: 'This is Aaron\'s bio.',
      avatar: 'images/avatar.png'
    }
  }));<commit_msg>feat(demo): Add event listener for card comments.<commit_after>'use strict';

function init() {

  const eventedElementId = 'eventedElement';
  const eventedElement = document.getElementById(eventedElementId);
  const foucTarget = document.getElementsByClassName('no-fouc')[0];

  // Un-hide the page elements now that the DOM has fully rendered
  foucTarget && (foucTarget.className = '');

  // Add the card container listeners, using the necessary event trigger
  document.body.dispatchEvent(new CustomEvent('cardstrap', {
    detail: '.container'
  }));

  // Listen for any events coming out of evented components
  eventedElement.addEventListener('card-comment', function(e) {
    console.info(`${e.detail.username} says "${e.detail.comment}"`);
  });

  // Initialize the card instances
  // Data in detail objects could come from a service endpoint

  eventedElement.dispatchEvent(new CustomEvent('initCard', {
    detail: {
      eventedElem: eventedElementId,
      targetElem: 'div1',
      userId: '3c832cbae883f988cfb877f4322d137c',
      username: 'aaron.kaka',
      bio: 'This is Aaron\'s bio.',
      avatar: 'images/avatar.png'
    }
  }));
{'fraction_non_alphanumeric': 0.11874386653581943, 'fraction_numerical': 0.021589793915603533, 'mean_word_length': 4.034567901234568, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7289132', 'n_tokens_mistral': 629, 'n_tokens_neox': 602, 'n_words': 160}