<commit_before>/**
 * App.js
 */

import { Router } from './modules/Router';
import { SCView } from './components/sc-view';

class App {
  constructor() {
    // Define custom elements
    this._bootstrapCustomElements();
    this._registerServiceWorker();
  }

  _registerServiceWorker() {
    if ('serviceWorker' in navigator) {
      console.warn('About to load the service worker yay');
    }
  }

  _bootstrapCustomElements() {
    // Get the user a proper top-level error if customElements are not supported
    if ('customElements' in window) {
      customElements.define('sc-view', SCView);
      this._bootstrapRouter();
    } else {
      const elementsNotSupported = document.createElement('h1');
      elementsNotSupported.innerText = 'Custom Elements are not supported in your browser';
      document.body.appendChild(elementsNotSupported);
    }
  }

  _bootstrapRouter() {
    const router = new Router();

    // Click handler for li elements in navigation list
    function onClick(evt) {
      router.go(evt.target.firstChild.href);
    }

    for (let link of document.querySelectorAll('.header .header-content nav li')) {
      console.log('Attaching listener');

      // Plain old li click listener
      link.addEventListener('click', onClick);

      /**
       * If the user clicks a link inside a list item
       * that link will be the `.target` of the event
       * passed into the onClick function - however we
       * always want to call onClick with the list item
       * as the event target so we can get its firstChild's
       * href
       */
      link.firstChild.addEventListener('click', evt => {<commit_msg>Get rid of CE not supported warning<commit_after>/**
 * App.js
 */

import { Router } from './modules/Router';
import { SCView } from './components/sc-view';

class App {
  constructor() {
    // Define custom elements
    this._bootstrapCustomElements();
    this._registerServiceWorker();
  }

  _registerServiceWorker() {
    if ('serviceWorker' in navigator) {
      console.warn('About to load the service worker yay');
    }
  }

  _bootstrapCustomElements() {
    // Get the user a proper top-level error if customElements are not supported
    if ('customElements' in window) {
      customElements.define('sc-view', SCView);
      this._bootstrapRouter();
    }
  }

  _bootstrapRouter() {
    const router = new Router();

    // Click handler for li elements in navigation list
    function onClick(evt) {
      router.go(evt.target.firstChild.href);
    }

    for (let link of document.querySelectorAll('.header .header-content nav li')) {
      console.log('Attaching listener');

      // Plain old li click listener
      link.addEventListener('click', onClick);

      /**
       * If the user clicks a link inside a list item
       * that link will be the `.target` of the event
       * passed into the onClick function - however we
       * always want to call onClick with the list item
       * as the event target so we can get its firstChild's
       * href
       */
      link.firstChild.addEventListener('click', evt => {
{'fraction_non_alphanumeric': 0.1054498548855208, 'fraction_numerical': 0.0003224766204450177, 'mean_word_length': 2.750906892382104, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '4767681', 'n_tokens_mistral': 828, 'n_tokens_neox': 814, 'n_words': 282}