Pārlūkot izejas kodu

NESBank.snapshot() was not intended to remain debounced. Method .snapshot() will now clear redo history if any.

dev
Bryan Miller pirms 6 gadiem
vecāks
revīzija
24146baf34
1 mainītis faili ar 3 papildinājumiem un 1 dzēšanām
  1. +3
    -1
      app/js/models/NESBank.js

+ 3
- 1
app/js/models/NESBank.js Parādīt failu

this.__redos = []; // Holds Base64 snapshots of work undone. this.__redos = []; // Holds Base64 snapshots of work undone.


this.__emitsEnabled = true; this.__emitsEnabled = true;
this.snapshot = Utils.debounce(this.snapshot.bind(this), 250);


var handle_datachanged = Utils.debounce((function(side, idx){ var handle_datachanged = Utils.debounce((function(side, idx){
var sendEmit = false; var sendEmit = false;




snapshot(){ snapshot(){
if (this.__redos.length > 0) // Remove the redo history. We're adding a new snapshot.
this.__redos = [];

var snap = this.base64; var snap = this.base64;
if (this.__undos.length === this.__historyLength){ if (this.__undos.length === this.__historyLength){
this.__undos.pop(); this.__undos.pop();

Notiek ielāde…
Atcelt
Saglabāt