<commit_before>/**
 * @fileoverview The primary SPF entry point.
 *
 * @author <EMAIL> (<NAME>)
 */

goog.provide('spf.main');

goog.require('spf');
goog.require('spf.debug');
goog.require('spf.history');
goog.require('spf.nav');
goog.require('spf.pubsub');


/**
 * Initialize SPF.
 *
 * @param {Object=} opt_config Optional configuration object.  Will be merged
 *     with {@link #defaults} and stored in {@link #config}.
 * @return {boolean} Whether SPF was successfully initialized.  If the HTML5
 *     history modification API is not supported, returns false.
 */
spf.main.init = function(opt_config) {
  var enable = !!(window.history.pushState);
  spf.debug.info('main.init ', 'enable=', enable);
  var config = opt_config || {};
  for (var key in spf.defaults) {
    var value = (key in config) ? config[key] : spf.defaults[key];
    spf.config[key] = value;
  }
  spf.debug.debug('    config', spf.config);
  if (enable) {
    spf.history.init(spf.nav.handleHistory);
    spf.nav.init();
  }
  return enable;
};


/**
 * Dispose SPF.
 */
spf.main.dispose = function() {
  var enable = !!(window.history.pushState);
  if (enable) {
    spf.nav.dispose();
    spf.history.dispose();
  }
  spf.pubsub.clear();
  spf.cache.clear();
  spf.config = {};
};


// Create the external API.
spf.init = spf.main.init;
spf.dispose = spf.main.dispose;
spf.navigate = spf.nav.navigate;
spf.load = spf.nav.load;
spf.process = spf.nav.process;
spf.prefetch = spf.nav.prefetch;
spf.preprocess = spf.nav.preprocess;


// When SPF is compiled for a production build, all methods are renamed by
// the compiler and wrapped in an anonymous function to prevent namespace
// pollution.  Only the methods exported here will be exposed to the page.
if (spf.DEBUG) {
  // When compiled for a debug build, allow access to entire namespace.
  window['spf'] = spf;
} else {
  window['spf'] = {
    'init': spf.init,
    'dispose': spf.dispose,
    'navigate': spf.navigate,
    'load': spf.load,<commit_msg>SPF: Remove pubsub and cache clearing from primary dispose function.<commit_after>/**
 * @fileoverview The primary SPF entry point.
 *
 * @author <EMAIL> (<NAME>)
 */

goog.provide('spf.main');

goog.require('spf');
goog.require('spf.debug');
goog.require('spf.history');
goog.require('spf.nav');
goog.require('spf.pubsub');


/**
 * Initialize SPF.
 *
 * @param {Object=} opt_config Optional configuration object.  Will be merged
 *     with {@link #defaults} and stored in {@link #config}.
 * @return {boolean} Whether SPF was successfully initialized.  If the HTML5
 *     history modification API is not supported, returns false.
 */
spf.main.init = function(opt_config) {
  var enable = !!(window.history.pushState);
  spf.debug.info('main.init ', 'enable=', enable);
  var config = opt_config || {};
  for (var key in spf.defaults) {
    var value = (key in config) ? config[key] : spf.defaults[key];
    spf.config[key] = value;
  }
  spf.debug.debug('    config', spf.config);
  if (enable) {
    spf.history.init(spf.nav.handleHistory);
    spf.nav.init();
  }
  return enable;
};


/**
 * Dispose SPF.
 */
spf.main.dispose = function() {
  var enable = !!(window.history.pushState);
  if (enable) {
    spf.nav.dispose();
    spf.history.dispose();
  }
  spf.config = {};
};


// Create the external API.
spf.init = spf.main.init;
spf.dispose = spf.main.dispose;
spf.navigate = spf.nav.navigate;
spf.load = spf.nav.load;
spf.process = spf.nav.process;
spf.prefetch = spf.nav.prefetch;
spf.preprocess = spf.nav.preprocess;


// When SPF is compiled for a production build, all methods are renamed by
// the compiler and wrapped in an anonymous function to prevent namespace
// pollution.  Only the methods exported here will be exposed to the page.
if (spf.DEBUG) {
  // When compiled for a debug build, allow access to entire namespace.
  window['spf'] = spf;
} else {
  window['spf'] = {
    'init': spf.init,
    'dispose': spf.dispose,
    'navigate': spf.navigate,
    'load': spf.load,
{'fraction_non_alphanumeric': 0.15646940822467403, 'fraction_numerical': 0.0005015045135406219, 'mean_word_length': 3.4769921436588103, 'pattern_counts': {'":': 0, '<': 7, '<?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': '703989', 'n_tokens_mistral': 1407, 'n_tokens_neox': 1377, 'n_words': 366}