close() {
    // Remmove from the DOM if it exists 
    document.querySelector(`#tab-${this.id}`).remove();

    // get the current list name
    let currentList = document.querySelector('#list-selector').innerText;


    if (currentList === 'All Tabs') {
      // Close the tab in the browser
      chrome.tabs.remove(this.id).then(
        console.log('Closed tab!')
      ).catch(
        console.log('Tab no longer open')
      );
    } else {
      // Otherwise Remove the tab from storage
      chrome.storage.sync.get('lists', (result) => {
        const cur = result['lists'][currentList];
        console.log(cur);

        // iterate through the list to find the index of the object to be removed
        let i = 0;
        while (i < cur.length && cur[i].title !== this.title) {
          i++;
        }

        // Remove the element from storage
        cur.splice(i, 1);

        // update storage with the new list
        const newObj = {
          'lists': {
            [currentList]: cur,
          }
        };

        chrome.storage.sync.set(newObj);
      })
    }
  }
/**
   * Closes this tab in thebrowser. 
   */
Closes this tab in thebrowser.
Closes this tab in thebrowser .
close() {
    document.querySelector(`#tab-${this.id}`).remove();
    let currentList = document.querySelector('#list-selector').innerText;
    if (currentList === 'All Tabs') {
      chrome.tabs.remove(this.id).then(
        console.log('Closed tab!')
      ).catch(
        console.log('Tab no longer open')
      );
    } else {
      chrome.storage.sync.get('lists', (result) => {
        const cur = result['lists'][currentList];
        console.log(cur);
        let i = 0;
        while (i < cur.length && cur[i].title !== this.title) {
          i++;
        }
        cur.splice(i, 1);
        const newObj = {
          'lists': {
            [currentList]: cur,
          }
        };
        chrome.storage.sync.set(newObj);
      })
    }
  }
close ( ) { document . querySelector ( ` ${ this . id } ` ) . remove ( ) ; let currentList = document . querySelector ( '#list-selector' ) . innerText ; if ( currentList === 'All Tabs' ) { chrome . tabs . remove ( this . id ) . then ( console . log ( 'Closed tab!' ) ) . catch ( console . log ( 'Tab no longer open' ) ) ; } else { chrome . storage . sync . get ( 'lists' , ( result ) => { const cur = result [ 'lists' ] [ currentList ] ; console . log ( cur ) ; let i = 0 ; while ( i < cur . length && cur [ i ] . title !== this . title ) { i ++ ; } cur . splice ( i , 1 ) ; const newObj = { 'lists' : { [ currentList ] : cur , } } ; chrome . storage . sync . set ( newObj ) ; } ) } }
Closes this tab in thebrowser.
Closes this tab in thebrowser .
// Remmove from the DOM if it exists  // get the current list name // Close the tab in the browser // Otherwise Remove the tab from storage // iterate through the list to find the index of the object to be removed // Remove the element from storage // update storage with the new list