Driver.html 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>The source code</title>
  6. <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
  7. <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
  8. <style type="text/css">
  9. .highlight { display: block; background-color: #ddd; }
  10. </style>
  11. <script type="text/javascript">
  12. function highlight() {
  13. document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
  14. }
  15. </script>
  16. </head>
  17. <body onload="prettyPrint(); highlight();">
  18. <pre class="prettyprint lang-js"><span id='Ext-ux-event-Driver'>/**
  19. </span> * This is the base class for {@link Ext.ux.event.Recorder} and {@link Ext.ux.event.Player}.
  20. */
  21. Ext.define('Ext.ux.event.Driver', {
  22. active: null,
  23. mixins: {
  24. observable: 'Ext.util.Observable'
  25. },
  26. constructor: function (config) {
  27. var me = this;
  28. me.mixins.observable.constructor.apply(this, arguments);
  29. me.addEvents(
  30. <span id='Ext-ux-event-Driver-event-start'> /**
  31. </span> * @event start
  32. * Fires when this object is started.
  33. * @param {Ext.ux.event.Driver} this
  34. */
  35. 'start',
  36. <span id='Ext-ux-event-Driver-event-stop'> /**
  37. </span> * @event stop
  38. * Fires when this object is stopped.
  39. * @param {Ext.ux.event.Driver} this
  40. */
  41. 'stop'
  42. );
  43. },
  44. getTime: function () {
  45. return new Date().getTime();
  46. },
  47. <span id='Ext-ux-event-Driver-method-getTimestamp'> /**
  48. </span> * Returns the number of milliseconds since start was called.
  49. */
  50. getTimestamp: function () {
  51. var d = this.getTime();
  52. return d - this.startTime;
  53. },
  54. onStart: function () {},
  55. onStop: function () {},
  56. <span id='Ext-ux-event-Driver-method-start'> /**
  57. </span> * Starts this object. If this object is already started, nothing happens.
  58. */
  59. start: function () {
  60. var me = this;
  61. if (!me.active) {
  62. me.active = new Date();
  63. me.startTime = me.getTime();
  64. me.onStart();
  65. me.fireEvent('start', me);
  66. }
  67. },
  68. <span id='Ext-ux-event-Driver-method-stop'> /**
  69. </span> * Stops this object. If this object is not started, nothing happens.
  70. */
  71. stop: function () {
  72. var me = this;
  73. if (me.active) {
  74. me.active = null;
  75. me.onStop();
  76. me.fireEvent('stop', me);
  77. }
  78. }
  79. });
  80. </pre>
  81. </body>
  82. </html>