EventArgs.js.html 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>JSDoc: Source: EventArgs.js</title>
  6. <script src="scripts/prettify/prettify.js"> </script>
  7. <script src="scripts/prettify/lang-css.js"> </script>
  8. <!--[if lt IE 9]>
  9. <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
  10. <![endif]-->
  11. <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
  12. <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
  13. </head>
  14. <body>
  15. <div id="main">
  16. <h1 class="page-title">Source: EventArgs.js</h1>
  17. <section>
  18. <article>
  19. <pre class="prettyprint source linenums"><code>// Licensed Materials - Property of IBM
  20. //
  21. // IBM Watson Analytics
  22. //
  23. // (C) Copyright IBM Corp. 2015
  24. //
  25. // US Government Users Restricted Rights - Use, duplication or
  26. // disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  27. module.exports = ( function( decl )
  28. {
  29. "use strict";
  30. /**
  31. * Create new EventArgs. Allows specifying a cancelable parameter as optional argument, which defaults to false.
  32. * @class module:barejs.EventArgs
  33. * @param {boolean} [_cancelable] Optional: provide a boolean to set whether this event is cancelable (default: prototype value, which is false for EventArgs).
  34. * @classdesc Base class for event arguments. Mimics html events cancelable behavior for events that have default behavior that can be canceled.
  35. * Subclasses can set the cancelable flag on their prototype, or use EventArgs.call( this, true ) to propagate the cancelable flag.
  36. */
  37. function EventArgs( /*cancelable*/ )
  38. {
  39. decl.defineProperties( this,
  40. {
  41. // Fixate the cancelable property for this object, either to argument 0 or the prototype value
  42. cancelable: { enumerable: true, value: ( typeof arguments[0] === "boolean" ? arguments[0] : this.cancelable === true ) },
  43. // Set defaultPrevented to false
  44. defaultPrevented: { configurable: true, enumerable: true, value: false }
  45. } );
  46. }
  47. return decl.declareClass( EventArgs,
  48. /** @lends module:barejs.EventArgs# */
  49. {
  50. /**
  51. * This value is true if the event got canceled (preventDefault was called, and cancelable is true).
  52. * @member {boolean}
  53. * @readonly
  54. */
  55. defaultPrevented: { enumerable: true, value: null },
  56. /**
  57. * The cancelable flag determines whether this event has behavior that can be canceled.
  58. * @member {boolean}
  59. * @readonly
  60. */
  61. cancelable: { enumerable: true, writable: true, value: false },
  62. /**
  63. * The preventDefault method will flag the EventArgs as defaultPrevented, if cancelable is true.
  64. * @function
  65. */
  66. preventDefault:
  67. {
  68. enumerable: true,
  69. value: function preventDefault()
  70. {
  71. if ( ( this.cancelable === true ) &amp;&amp; !this.defaultPrevented )
  72. decl.defineProperty( this, "defaultPrevented", { enumerable: true, value: true } );
  73. }
  74. }
  75. } );
  76. // End of define
  77. }( require( "./decl" ) ) );
  78. </code></pre>
  79. </article>
  80. </section>
  81. </div>
  82. <nav>
  83. <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-barejs.html">barejs</a></li><li><a href="module-barejs_polyfill.html">barejs/polyfill</a></li><li><a href="module-barejs_polyfill_Intl.html">barejs/polyfill/Intl</a></li></ul><h3>Classes</h3><ul><li><a href="module-barejs.decl.html">decl</a></li><li><a href="module-barejs.decl-Enum.html">Enum</a></li><li><a href="module-barejs.decl-Interface.html">Interface</a></li><li><a href="module-barejs.decl-SpecialType.html">SpecialType</a></li><li><a href="module-barejs.Destroyable.html">Destroyable</a></li><li><a href="module-barejs.EventArgs.html">EventArgs</a></li><li><a href="module-barejs.Evented.html">Evented</a></li><li><a href="module-barejs.Evented-EventedHandle.html">EventedHandle</a></li><li><a href="module-barejs.Exception.html">Exception</a></li><li><a href="module-barejs_polyfill.Array.html">Array</a></li><li><a href="module-barejs_polyfill.Date.html">Date</a></li><li><a href="module-barejs_polyfill.EntryStore.html">EntryStore</a></li><li><a href="module-barejs_polyfill.EntryStore.Iterator.html">Iterator</a></li><li><a href="module-barejs_polyfill.Function.html">Function</a></li><li><a href="module-barejs_polyfill.Map.html">Map</a></li><li><a href="module-barejs_polyfill.Map-MapIterator.html">MapIterator</a></li><li><a href="module-barejs_polyfill.Math.html">Math</a></li><li><a href="module-barejs_polyfill.Number.html">Number</a></li><li><a href="module-barejs_polyfill.Object.html">Object</a></li><li><a href="module-barejs_polyfill.Promise.html">Promise</a></li><li><a href="module-barejs_polyfill.Set.html">Set</a></li><li><a href="module-barejs_polyfill.Set-SetIterator.html">SetIterator</a></li><li><a href="module-barejs_polyfill.String.html">String</a></li><li><a href="module-barejs_polyfill.Symbol.html">Symbol</a></li><li><a href="module-barejs_polyfill.WeakMap.html">WeakMap</a></li><li><a href="module-barejs_polyfill.WeakSet.html">WeakSet</a></li><li><a href="module-barejs_polyfill_Intl.DateTimeFormat.html">DateTimeFormat</a></li><li><a href="module-barejs_polyfill_Intl.DateTimeFormat-DateTimeFormatOptions.html">DateTimeFormatOptions</a></li><li><a href="module-barejs_polyfill_Intl.NumberFormat.html">NumberFormat</a></li><li><a href="module-barejs_polyfill_Intl.NumberFormat-NumberFormatOptions.html">NumberFormatOptions</a></li><li><a href="module-barejs_polyfill_Intl-Format.html">Format</a></li></ul>
  84. </nav>
  85. <br class="clear">
  86. <footer>
  87. Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Wed Oct 03 2018 15:59:33 GMT+0200 (W. Europe Daylight Time)
  88. </footer>
  89. <script> prettyPrint(); </script>
  90. <script src="scripts/linenumber.js"> </script>
  91. </body>
  92. </html>