eventinfo.js 968 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /**
  2. * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. 'use strict';
  6. /**
  7. * The event object passed to event callbacks. It is used to provide information about the event as well as a tool to
  8. * manipulate it.
  9. *
  10. * @class EventInfo
  11. */
  12. CKEDITOR.define( [ 'utils' ], ( utils ) => {
  13. class EventInfo {
  14. constructor( source, name ) {
  15. /**
  16. * The object that fired the event.
  17. */
  18. this.source = source;
  19. /**
  20. * The event name.
  21. */
  22. this.name = name;
  23. // The following methods are defined in the constructor because they must be re-created per instance.
  24. /**
  25. * Stops the event emitter to call further callbacks for this event interaction.
  26. *
  27. * @method
  28. */
  29. this.stop = utils.spy();
  30. /**
  31. * Removes the current callback from future interactions of this event.
  32. *
  33. * @method
  34. */
  35. this.off = utils.spy();
  36. }
  37. }
  38. return EventInfo;
  39. } );