eventInfo.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /**
  2. * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md or http://ckeditor.com/license
  4. */
  5. /**
  6. * @fileOverview Defines the "virtual" {@link CKEDITOR.eventInfo} class, which
  7. * contains the defintions of the event object passed to event listeners.
  8. * This file is for documentation purposes only.
  9. */
  10. /**
  11. * Virtual class that illustrates the features of the event object to be
  12. * passed to event listeners by a {@link CKEDITOR.event} based object.
  13. *
  14. * This class is not really part of the API.
  15. *
  16. * @class CKEDITOR.eventInfo
  17. * @abstract
  18. */
  19. /**
  20. * The event name.
  21. *
  22. * someObject.on( 'someEvent', function( event ) {
  23. * alert( event.name ); // 'someEvent'
  24. * } );
  25. * someObject.fire( 'someEvent' );
  26. *
  27. * @property {String} name
  28. */
  29. /**
  30. * The object that publishes (sends) the event.
  31. *
  32. * someObject.on( 'someEvent', function( event ) {
  33. * alert( event.sender == someObject ); // true
  34. * } );
  35. * someObject.fire( 'someEvent' );
  36. *
  37. * @property sender
  38. */
  39. /**
  40. * The editor instance that holds the sender. May be the same as sender. May be
  41. * null if the sender is not part of an editor instance, like a component
  42. * running in standalone mode.
  43. *
  44. * myButton.on( 'someEvent', function( event ) {
  45. * alert( event.editor == myEditor ); // true
  46. * } );
  47. * myButton.fire( 'someEvent', null, myEditor );
  48. *
  49. * @property {CKEDITOR.editor} editor
  50. */
  51. /**
  52. * Any kind of additional data. Its format and usage is event dependent.
  53. *
  54. * someObject.on( 'someEvent', function( event ) {
  55. * alert( event.data ); // 'Example'
  56. * } );
  57. * someObject.fire( 'someEvent', 'Example' );
  58. *
  59. * @property data
  60. */
  61. /**
  62. * Any extra data appended during the listener registration.
  63. *
  64. * someObject.on( 'someEvent', function( event ) {
  65. * alert( event.listenerData ); // 'Example'
  66. * }, null, 'Example' );
  67. *
  68. * @property listenerData
  69. */
  70. /**
  71. * Indicates that no further listeners are to be called.
  72. *
  73. * someObject.on( 'someEvent', function( event ) {
  74. * event.stop();
  75. * } );
  76. * someObject.on( 'someEvent', function( event ) {
  77. * // This one will not be called.
  78. * } );
  79. * alert( someObject.fire( 'someEvent' ) ); // true
  80. *
  81. * @method stop
  82. */
  83. /**
  84. * Indicates that the event is to be cancelled (if cancelable).
  85. *
  86. * someObject.on( 'someEvent', function( event ) {
  87. * event.cancel();
  88. * } );
  89. * someObject.on( 'someEvent', function( event ) {
  90. * // This one will not be called.
  91. * } );
  92. * alert( someObject.fire( 'someEvent' ) ); // false
  93. *
  94. * @method cancel
  95. */
  96. /**
  97. * Removes the current listener.
  98. *
  99. * someObject.on( 'someEvent', function( event ) {
  100. * event.removeListener();
  101. * // Now this function won't be called again by 'someEvent'.
  102. * } );
  103. *
  104. * @method removeListener
  105. */