# DOFEvent

This Event class represents DOF-related events.

The event target for this event type is the mainWindow object.

There's currently only one subtype of this event:

- dofevent: Fires when the system is about to change the value of a DOF named event. See DOF Events for a full list of the named events that PinballY generates.

  This event is fired at each change to a DOF named event, so you'll get one notification when PinballY turns the event ON, and another when PinballY turns the event OFF. Most of the DOF events that PinballY generates are momentary "pulsed" events, meaning that PinballY turns the event ON briefly and then turns it right back OFF. For example, the events representing key presses, menu selections, and other discrete UI actions are all "pulsed". For such events, you'll see two dofevent notifications in quick succession, one for the change to ON status, and one for the change to OFF status. The DOF named events that represent the current UI state (PBYWheel, PBYMenu, etc) are left ON as long as the state is in effect, as are the named events that represent the current game ROM selection in the wheel UI.

  This event is cancelable. If you call preventDefault() on the event object passed to the handler, PinballY won't update the DOF named event after all.

DOF-related events are only fired if DOF is installed in your system and PinballY is connected to it. PinballY doesn't bother firing the events if DOF isn't being used.

## Properties

This event type has all of the standard event properties and methods (see the Event class), plus the additional properties listed below.

- name: For dofevent events, a string giving the name of the DOF event being turned on or off. See DOF Events for a list of the DOF event names that PinballY uses.
- value: For dofevent events, a number from 0 to 255 giving the updated value of the named event. PinballY uses 0 for "OFF" and 1 for "ON" for most events.