--- title: Window.ongamepaddisconnected slug: Web/API/Window/ongamepaddisconnected translation_of: Web/API/Window/ongamepaddisconnected ---
{{DefaultAPISidebar("Gamepad API")}}{{SeeCompatTable}}

The ongamepaddisconnected property of the {{domxref("Window")}} interface represents an event handler that will run when a gamepad is disconnected (when the {{event('gamepaddisconnected')}} event fires).

The event object is of type {{domxref("GamepadEvent")}}.

解析

window.ongamepaddisconnected = function() { ... };

示例

window.ongamepaddisconnected = function() {
  // A gamepad has been disconnected
};

Specifications

Specification Status Comment
{{SpecName('Gamepad ', '#event-gamepaddisconnected', 'gamepaddisconnected event')}} {{Spec2('Gamepad')}} Initial definition

Browser compatibility

{{Compat("api.Window.ongamepaddisconnected")}}

See also