{"size": 780, "ext": "js", "max_stars_repo_path": "dev/js/components/report.js", "max_stars_repo_name": "Amphiluke/open-evolver", "max_stars_repo_stars_event_min_datetime": "2020-08-07T13:52:59.000Z", "max_stars_repo_stars_event_max_datetime": "2020-08-07T13:52:59.000Z", "max_issues_repo_path": "dev/js/components/report.js", "max_issues_repo_name": "Amphiluke/open-evolver", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "dev/js/components/report.js", "max_forks_repo_name": "Amphiluke/open-evolver", "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": 31.2, "max_line_length": 100, "alphanum_fraction": 0.658974359}
import $ from "jquery";
import AbstractDialog from "./abstract-dialog.js";
import app from "../app.js";
import worker from "../worker.js";
import templates from "../templates.js";

let report = Object.assign(new AbstractDialog(".oe-report"), {
    handleGlobalKeyUp: $.noop, // override the inherited behavior hiding the dialog on Esc key press

    print(data) {
        this.updateProgress(100);
        $("#oe-report-data").html(templates.get("report")({energy: data.energy, grad: data.norm}));
    },

    updateProgress(value) {
        $("#oe-report-progress").attr("value", value);
    }
});

report.listen([
    {type: "app:structure:loaded", owner: app, handler: "hide"},
    {type: "evolve:progress", owner: worker, handler: "updateProgress"}
]);

export default report;