<commit_before>import Utils from './utils';
import events from './events';

const f7 = {
  instance: null,
  Framework7: null,
  init(rootEl, params = {}, routes) {
    const f7Params = Utils.extend({}, params, {
      root: rootEl,
    });
    if (routes && routes.length && !f7Params.routes) f7Params.routes = routes;

    f7.instance = new f7.Framework7(f7Params);
    if (f7.instance.initialized) {
      events.emit('ready', f7.instance);
    } else {
      f7.instance.on('init', () => {
        events.emit('ready', f7.instance);
      });
    }
  },
  ready(callback) {
    if (!callback) return;
    if (f7.instance) callback(f7.instance);
    else {
      events.once('ready', callback);
    }
  },
  routers: {
    views: [],
    tabs: [],
    modals: null,
  },
};

export default f7;<commit_msg>v4: Phenome: Make sure not to call f7ready when app not initialized<commit_after>import Utils from './utils';
import events from './events';

const f7 = {
  instance: null,
  Framework7: null,
  init(rootEl, params = {}, routes) {
    const f7Params = Utils.extend({}, params, {
      root: rootEl,
    });
    if (routes && routes.length && !f7Params.routes) f7Params.routes = routes;

    const instance = new f7.Framework7(f7Params);
    if (instance.initialized) {
      f7.instance = instance;
      events.emit('ready', f7.instance);
    } else {
      instance.on('init', () => {
        f7.instance = instance;
        events.emit('ready', f7.instance);
      });
    }
  },
  ready(callback) {
    if (!callback) return;
    if (f7.instance) callback(f7.instance);
    else {
      events.once('ready', callback);
    }
  },
  routers: {
    views: [],
    tabs: [],
    modals: null,
  },
};

export default f7;
{'fraction_non_alphanumeric': 0.16483516483516483, 'fraction_numerical': 0.019086176980913822, 'mean_word_length': 2.649789029535865, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '4192094', 'n_tokens_mistral': 587, 'n_tokens_neox': 586, 'n_words': 131}