{"size": 715, "ext": "js", "max_stars_repo_path": "public/GoWorker.js", "max_stars_repo_name": "mjschust/go-wasm-app", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "public/GoWorker.js", "max_issues_repo_name": "mjschust/go-wasm-app", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "public/GoWorker.js", "max_forks_repo_name": "mjschust/go-wasm-app", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 23.8333333333, "max_line_length": 80, "alphanum_fraction": 0.6293706294}
self.importScripts('wasm_exec.js');

const go = new global.Go();

const queryFunctions = {
  loadModule({ wasmModule }) {
    global.WebAssembly.instantiate(wasmModule, go.importObject).then(result => {
      go.run(result);
      postMessage({reponseMethod: 'moduleLoaded'});
      });
  },
  computeRanks(args) {
    global.goModules.testModule.computeRankData(
      args, 
      (wt, rank) => {
      const msg = {
        responseMethod: 'addRank',
        responseArgs: { wt: Array.from(wt), rank: parseInt(rank) }
      };
      postMessage(msg);
    });
  }
};

self.onmessage = function(event) {
  const query = event.data.queryMethod;
  const args = event.data.queryArgs;
  queryFunctions[query](args);
}
