function initialize() {
    uiHandler = new mojom.DiscardsDetailsProviderPtr;
    Mojo.bindInterface(
        mojom.DiscardsDetailsProvider.name, mojo.makeRequest(uiHandler).handle);

    tabDiscardsInfoTableBody = $('tab-discards-info-table-body');
    infos = [];
    sortKey = 'utilityRank';
    sortReverse = false;
    updateTimer = null;

    // Set the column sort handlers.
    let tabDiscardsInfoTableHeader = $('tab-discards-info-table-header');
    let headers = tabDiscardsInfoTableHeader.children;
    for (let header of headers) {
      header.addEventListener('click', (e) => {
        let newSortKey = e.target.dataset.sortKey;

        // Skip columns that aren't explicitly labeled with a sort-key
        // attribute.
        if (newSortKey == null)
          return;

        // Reverse the sort key if the key itself hasn't changed.
        if (sortKey == newSortKey) {
          sortReverse = !sortReverse;
        } else {
          sortKey = newSortKey;
          sortReverse = false;
        }

        // Undecorate the old sort column, and decorate the new one.
        let oldSortColumn = document.querySelector('.sort-column');
        oldSortColumn.classList.remove('sort-column');
        e.target.classList.add('sort-column');
        if (sortReverse)
          e.target.setAttribute('data-sort-reverse', '');
        else
          e.target.removeAttribute('data-sort-reverse');

        sortTabDiscardsInfoTable();
        renderTabDiscardsInfoTable();
      });
    }

    // Setup the "Discard a tab now" links.
    let discardNow = $('discard-now-link');
    let discardNowUrgent = $('discard-now-urgent-link');
    let discardListener = function(e) {
      e.target.setAttribute('disabled', '');
      let urgent = e.target.id.includes('urgent');
      uiHandler.discard(urgent).then(() => {
        stableUpdateTabDiscardsInfoTable();
        e.target.removeAttribute('disabled');
      });
    };
    discardNow.addEventListener('click', discardListener);
    discardNowUrgent.addEventListener('click', discardListener);

    stableUpdateTabDiscardsInfoTable();
  }
/**
   * Initializes this page. Invoked by the DOMContentLoaded event.
   */
Initializes this page. Invoked by the DOMContentLoaded event.
Initializes this page . Invoked by the DOMContentLoaded event .
function initialize() {
    uiHandler = new mojom.DiscardsDetailsProviderPtr;
    Mojo.bindInterface(
        mojom.DiscardsDetailsProvider.name, mojo.makeRequest(uiHandler).handle);
    tabDiscardsInfoTableBody = $('tab-discards-info-table-body');
    infos = [];
    sortKey = 'utilityRank';
    sortReverse = false;
    updateTimer = null;
    let tabDiscardsInfoTableHeader = $('tab-discards-info-table-header');
    let headers = tabDiscardsInfoTableHeader.children;
    for (let header of headers) {
      header.addEventListener('click', (e) => {
        let newSortKey = e.target.dataset.sortKey;
        if (newSortKey == null)
          return;
        if (sortKey == newSortKey) {
          sortReverse = !sortReverse;
        } else {
          sortKey = newSortKey;
          sortReverse = false;
        }
        let oldSortColumn = document.querySelector('.sort-column');
        oldSortColumn.classList.remove('sort-column');
        e.target.classList.add('sort-column');
        if (sortReverse)
          e.target.setAttribute('data-sort-reverse', '');
        else
          e.target.removeAttribute('data-sort-reverse');
        sortTabDiscardsInfoTable();
        renderTabDiscardsInfoTable();
      });
    }
    let discardNow = $('discard-now-link');
    let discardNowUrgent = $('discard-now-urgent-link');
    let discardListener = function(e) {
      e.target.setAttribute('disabled', '');
      let urgent = e.target.id.includes('urgent');
      uiHandler.discard(urgent).then(() => {
        stableUpdateTabDiscardsInfoTable();
        e.target.removeAttribute('disabled');
      });
    };
    discardNow.addEventListener('click', discardListener);
    discardNowUrgent.addEventListener('click', discardListener);
    stableUpdateTabDiscardsInfoTable();
  }
function initialize ( ) { uiHandler = new mojom . DiscardsDetailsProviderPtr ; Mojo . bindInterface ( mojom . DiscardsDetailsProvider . name , mojo . makeRequest ( uiHandler ) . handle ) ; tabDiscardsInfoTableBody = $ ( 'tab-discards-info-table-body' ) ; infos = [ ] ; sortKey = 'utilityRank' ; sortReverse = false ; updateTimer = null ; let tabDiscardsInfoTableHeader = $ ( 'tab-discards-info-table-header' ) ; let headers = tabDiscardsInfoTableHeader . children ; for ( let header of headers ) { header . addEventListener ( 'click' , ( e ) => { let newSortKey = e . target . dataset . sortKey ; if ( newSortKey == null ) return ; if ( sortKey == newSortKey ) { sortReverse = ! sortReverse ; } else { sortKey = newSortKey ; sortReverse = false ; } let oldSortColumn = document . querySelector ( '.sort-column' ) ; oldSortColumn . classList . remove ( 'sort-column' ) ; e . target . classList . add ( 'sort-column' ) ; if ( sortReverse ) e . target . setAttribute ( 'data-sort-reverse' , '' ) ; else e . target . removeAttribute ( 'data-sort-reverse' ) ; sortTabDiscardsInfoTable ( ) ; renderTabDiscardsInfoTable ( ) ; } ) ; } let discardNow = $ ( 'discard-now-link' ) ; let discardNowUrgent = $ ( 'discard-now-urgent-link' ) ; let discardListener = function ( e ) { e . target . setAttribute ( 'disabled' , '' ) ; let urgent = e . target . id . includes ( 'urgent' ) ; uiHandler . discard ( urgent ) . then ( ( ) => { stableUpdateTabDiscardsInfoTable ( ) ; e . target . removeAttribute ( 'disabled' ) ; } ) ; } ; discardNow . addEventListener ( 'click' , discardListener ) ; discardNowUrgent . addEventListener ( 'click' , discardListener ) ; stableUpdateTabDiscardsInfoTable ( ) ; }
Initializes this page.
Initializes this page .
// Set the column sort handlers. // Skip columns that aren't explicitly labeled with a sort-key // attribute. // Reverse the sort key if the key itself hasn't changed. // Undecorate the old sort column, and decorate the new one. // Setup the "Discard a tab now" links.