modular-synthesizer / frontend

The frontend for the Synple application
https://synple.app/
0 stars 0 forks source link

Make the parameters edition reversible #56

Open vincentcourtois opened 1 year ago

vincentcourtois commented 1 year ago

Needs

As a user editing a synthesizer
I want to be able to cancel my last parameter edition
So that I can easily fix errors or make tests on parameters

Notes

vincentcourtois commented 1 year ago

To achieve this, we should use the command design pattern to store a list of reversible commands. A command would contain the callback usable to reverse it, accepting the object as argument.

Something like :

export default class Command<T> {
  private reverse: (T) => void;
  public constructor(reverse: (T) => void) {
    this.reverse = reverse;
  }
  public cancel() {
    return this.reverse();
  }
}