eventinfo.js 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. * @memberOf core
  12. */
  13. export default class EventInfo {
  14. constructor( source, name ) {
  15. /**
  16. * The object that fired the event.
  17. *
  18. * @member core.EventInfo#source
  19. */
  20. this.source = source;
  21. /**
  22. * The event name.
  23. *
  24. * @member core.EventInfo#name
  25. */
  26. this.name = name;
  27. // The following methods are defined in the constructor because they must be re-created per instance.
  28. /**
  29. * Stops the event emitter to call further callbacks for this event interaction.
  30. *
  31. * @method core.EventInfo#stop
  32. */
  33. this.stop = utils.spy();
  34. /**
  35. * Removes the current callback from future interactions of this event.
  36. *
  37. * @method core.EventInfo#off
  38. */
  39. this.off = utils.spy();
  40. }
  41. }