Command.js 605 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /**
  2. * @param editor pointer to main editor object used to initialize
  3. * each command object with a reference to the editor
  4. * @constructor
  5. */
  6. class Command {
  7. constructor( editor ) {
  8. this.id = - 1;
  9. this.inMemory = false;
  10. this.updatable = false;
  11. this.type = '';
  12. this.name = '';
  13. this.editor = editor;
  14. }
  15. toJSON() {
  16. const output = {};
  17. output.type = this.type;
  18. output.id = this.id;
  19. output.name = this.name;
  20. return output;
  21. }
  22. fromJSON( json ) {
  23. this.inMemory = true;
  24. this.type = json.type;
  25. this.id = json.id;
  26. this.name = json.name;
  27. }
  28. }
  29. export { Command };