Command.js 874 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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 editorRef 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 ( editorRef ) {
  11. this.id = - 1;
  12. this.inMemory = false;
  13. this.updatable = false;
  14. this.type = '';
  15. this.name = '';
  16. if ( editorRef !== undefined ) {
  17. Command.editor = editorRef;
  18. }
  19. this.editor = Command.editor;
  20. };
  21. Command.prototype.toJSON = function () {
  22. var output = {};
  23. output.type = this.type;
  24. output.id = this.id;
  25. output.name = this.name;
  26. return output;
  27. };
  28. Command.prototype.fromJSON = function ( json ) {
  29. this.inMemory = true;
  30. this.type = json.type;
  31. this.id = json.id;
  32. this.name = json.name;
  33. };