Capturing DOM events - WaterfallEngineering/reanimator GitHub Wiki
This page specifies how a plugin should capture DOM events for replay in Reanimator.
A plugin MUST NOT capture synthetic events created by document.createEvent
. An event e
can be determined to be synthetic by checking if e._reanimator.synthetic
is true
.
A plugin MUST NOT capture synthetic events created by other means, such as jQuery's trigger
method.
A plugin MUST NOT capture events that have already been captured. An event e
can be determined to have been captured by checking if e._reanimator.captured
is true
.
To capture an event, a plugin pushes an object onto the events
array property of the log
object that was passed to its capture
method. That object MUST have the following properties:
type
: the event type. Its value MUST bedom
.time
: the current time, as returned by thenow
method of theDate
property of thenative
object passed to the plugin'scapture
methoddetails
: the details of the DOM event. It MUST have the following properties:type
: the DOM event type of the captured eventdetails
: the serialized event, obtained by callingReanimator.util.event.serialization.serialize
and passing the captured event
If the plugin captures an event, it MUST check if the event has a _reanimator
property. If not, it MUST set that property to be an empty object: {}
. The plugin must then set the captured
property of the _reanimator
property to true
.