<commit_before>(function () {
	var ns = $.namespace("pskl");
	ns.HistoryManager = function (framesheet) {
    this.framesheet = framesheet; 
  };

	ns.HistoryManager.prototype.init = function () {
    $.subscribe(Events.TOOL_RELEASED, this.saveState.bind(this));

    $.subscribe(Events.UNDO, this.undo.bind(this));
    $.subscribe(Events.REDO, this.redo.bind(this));
	};

  ns.HistoryManager.prototype.saveState = function () {
    this.framesheet.getCurrentFrame().saveState();
  };

  ns.HistoryManager.prototype.undo = function () {
    this.framesheet.getCurrentFrame().loadPreviousState();
    this.redraw();
  };

  ns.HistoryManager.prototype.redo = function () {
    this.framesheet.getCurrentFrame().loadNextState();
    this.redraw();
  };

  ns.HistoryManager.prototype.redraw = function () {
    this.framesheet.drawingController.renderFrame();
    this.framesheet.previewsController.createPreviews();
  };
})();<commit_msg>History manager is firing events to trigger redraw of listeners<commit_after>(function () {
	var ns = $.namespace("pskl");
	ns.HistoryManager = function (framesheet) {
    this.framesheet = framesheet; 
  };

	ns.HistoryManager.prototype.init = function () {
    $.subscribe(Events.TOOL_RELEASED, this.saveState.bind(this));

    $.subscribe(Events.UNDO, this.undo.bind(this));
    $.subscribe(Events.REDO, this.redo.bind(this));
	};

  ns.HistoryManager.prototype.saveState = function () {
    this.framesheet.getCurrentFrame().saveState();
  };

  ns.HistoryManager.prototype.undo = function () {
    this.framesheet.getCurrentFrame().loadPreviousState();
    $.publish(Events.FRAMESHEET_RESET);
  };

  ns.HistoryManager.prototype.redo = function () {
    this.framesheet.getCurrentFrame().loadNextState();
    $.publish(Events.FRAMESHEET_RESET);
  };

})();
{'fraction_non_alphanumeric': 0.1596218020022247, 'fraction_numerical': 0.0, 'mean_word_length': 4.275659824046921, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3265314', 'n_tokens_mistral': 558, 'n_tokens_neox': 550, 'n_words': 69}