Command.js 810 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /**
  2. * @author dforrer / https://github.com/dforrer
  3. * Developed as part of a project at University of Applied Sciences and Arts Northwestern Switzerland (www.fhnw.ch)
  4. */
  5. /**
  6. * @param editor pointer to main editor object used to initialize
  7. * each command object with a reference to the editor
  8. * @constructor
  9. */
  10. var Command = function ( editor ) {
  11. this.id = - 1;
  12. this.inMemory = false;
  13. this.updatable = false;
  14. this.type = '';
  15. this.name = '';
  16. this.editor = editor;
  17. };
  18. Command.prototype.toJSON = function () {
  19. var output = {};
  20. output.type = this.type;
  21. output.id = this.id;
  22. output.name = this.name;
  23. return output;
  24. };
  25. Command.prototype.fromJSON = function ( json ) {
  26. this.inMemory = true;
  27. this.type = json.type;
  28. this.id = json.id;
  29. this.name = json.name;
  30. };
  31. export { Command };