<commit_before>const semver = require('semver');
const _defaults = require('lodash.defaults');

const defaults = {
  autorefresh: -1,
  content: 'A new version is available!'
};

const globalDefaults = {
  versionjs: window.version,
  major: defaults,
  minor: defaults,
  patch: defaults
};

const Reload = function () {
  this.opts = globalDefaults;
};

Reload.prototype = {
  options(opts) {
    this.opts = _defaults(globalDefaults, opts);
    if (this.opts.versionjs) {
      this.start();
    }
    return this;
  },

  start() {
    if (this._interval) return this;
    // if this has been run before then load the
    // version from localstorage so we can start
    this.opts.version = localStorage.getItem('reload-prev-version');
    this.opts.versionjs.bind('load', () => {
      this.update(this.opts.versionjs.tag({ repo: this.opts.repo }));
    });
    // check for new version every 20 seconds
    this._interval = setInterval(() => {
      this.opts.versionjs.load();
    }, 5000);
    return this;
  },
<commit_msg>fixed order of default variables<commit_after>const semver = require('semver');
const _defaults = require('lodash.defaults');

const defaults = {
  autorefresh: -1, // do not autorefresh
  content: 'A new version is available!'
};

const globalDefaults = {
  versionjs: window.version,
  major: defaults,
  minor: defaults,
  patch: defaults,
  interval: 10 * 1000 // 10 seconds by default
};

const Reload = function () {
  this.opts = globalDefaults;
};

Reload.prototype = {
  options(opts) {
    this.opts = _defaults(opts, globalDefaults);
    if (this.opts.versionjs) {
      this.start();
    }
    return this;
  },

  start() {
    if (this._interval) return this;
    // if this has been run before then load the
    // version from localstorage so we can start
    this.opts.version = localStorage.getItem('reload-prev-version');
    this.opts.versionjs.bind('load', () => {
      this.update(this.opts.versionjs.tag({ repo: this.opts.repo }));
      this.poll();
    });
    // check for new version every 20 seconds
    this.poll();
    return this;
  },

  poll() {
    this._interval = setTimeout(() => {
      this.opts.versionjs.load();
    }, 5000);
  },

{'fraction_non_alphanumeric': 0.14240362811791382, 'fraction_numerical': 0.009977324263038548, 'mean_word_length': 3.0255474452554743, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '6901522', 'n_tokens_mistral': 709, 'n_tokens_neox': 678, 'n_words': 179}