<commit_before>import VirtualizedList from '../../src';

const ROW_HEIGHT = 80;
const CONTAINER_STYLE = 'width: 400px; height: 600px; overflow-y: auto; border: 1px solid #DDD; margin: 50px auto;';
const ELEMENT_STYLE = `height: ${ROW_HEIGHT}px; border-bottom: 1px solid #DDD; box-sizing: border-box; display: flex; align-items: center; justify-content: center; font-weight: bold; font-size: 18px; font-family: sans-serif; color: #333;';`;

// Here, we're generating an array of 1000 numbers [0, 1, 2, 3, 4, ...] to use as our dataset
const data = Array.from(Array(1000).keys());

(function() {
  // Make sure you have a container to render into
  const container = document.createElement('div');
  container.setAttribute('style', CONTAINER_STYLE);
  document.body.append(container);

  // Initialize our VirtualizedList
  var virtualizedList = new VirtualizedList(container, {
    data,
    rowHeight: ROW_HEIGHT,
    renderRow: (row) => {
      const element = document.createElement('div');
      element.setAttribute('style', ELEMENT_STYLE);
      element.innerHTML = row;

      return element;
    }
  });
})();
<commit_msg>Usage example of scrollToIndex and onMount<commit_after>import VirtualizedList from '../../src';

const ROW_HEIGHT = 80;
const CONTAINER_STYLE = 'width: 400px; height: 600px; overflow-y: auto; border: 1px solid #DDD; margin: 50px auto;';
const ELEMENT_STYLE = `height: ${ROW_HEIGHT}px; border-bottom: 1px solid #DDD; box-sizing: border-box; display: flex; align-items: center; justify-content: center; font-weight: bold; font-size: 18px; font-family: sans-serif; color: #333;';`;

// Here, we're generating an array of 1000 numbers [0, 1, 2, 3, 4, ...] to use as our dataset
const data = Array.from(Array(1000).keys());

(function() {
  // Make sure you have a container to render into
  const container = document.createElement('div');
  container.setAttribute('style', CONTAINER_STYLE);
  document.body.append(container);

  // Initialize our VirtualizedList
  var virtualizedList = new VirtualizedList(container, {
    data,
    rowHeight: ROW_HEIGHT,
    renderRow: (row) => {
      const element = document.createElement('div');
      element.setAttribute('style', ELEMENT_STYLE);
      element.innerHTML = row;

      return element;
    },
    onMount: () => {
      // We can set the initial index in the onMount callback
      virtualizedList.scrollToIndex(100);
    }
  });
})();

{'fraction_non_alphanumeric': 0.138900372054568, 'fraction_numerical': 0.026043819760231502, 'mean_word_length': 4.062761506276151, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, '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': '6297266', 'n_tokens_mistral': 818, 'n_tokens_neox': 751, 'n_words': 225}