Command.js 618 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. class Command {
  2. /**
  3. * @param {Editor} editor pointer to main editor object used to initialize
  4. * each command object with a reference to the editor
  5. * @constructor
  6. */
  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 };
粤ICP备19079148号