{"size": 872, "ext": "js", "max_stars_repo_path": "libs/content_scripts/page_done.js", "max_stars_repo_name": "fChristenson/bookie", "max_stars_repo_stars_event_min_datetime": "2020-01-17T07:47:21.000Z", "max_stars_repo_stars_event_max_datetime": "2020-01-17T07:47:21.000Z", "max_issues_repo_path": "libs/content_scripts/page_done.js", "max_issues_repo_name": "fChristenson/bookie", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "libs/content_scripts/page_done.js", "max_forks_repo_name": "fChristenson/bookie", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 27.25, "max_line_length": 64, "alphanum_fraction": 0.6754587156}
var script = document.createElement('script');
script.src = chrome.extension.getURL('libs/public_api.js');
document.body.appendChild(script);

document.addEventListener('bookie', function(e) {
  port.postMessage(e.detail);
});

var port = chrome.extension.connect({name: 'Run scripts'});

port.onMessage.addListener(function(msg) {
  var obj;

  if(msg.type === 'script') {
    obj = {detail: {type: msg.type, script: msg.script}};
    document.dispatchEvent(new CustomEvent('bookie_page', obj));
  }

  if(msg.type === 'store') {
    obj = {detail: {type: msg.type, store: msg.store}};
    document.dispatchEvent(new CustomEvent('bookie_page', obj));
  }

  if(msg.type === 'queue') {
    obj = {detail: {type: msg.type, queue: msg.queue}};
    document.dispatchEvent(new CustomEvent('bookie_page', obj));
  }
});

port.postMessage('getStore');
port.postMessage('done');
