8
0

eventinfo.js 921 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /**
  2. * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. 'use strict';
  6. import utils from './utils.js';
  7. /**
  8. * The event object passed to event callbacks. It is used to provide information about the event as well as a tool to
  9. * manipulate it.
  10. *
  11. * @class EventInfo
  12. */
  13. export default 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. }