Updated add/removeEventListener typings

The add/removeEventListeners should accept a type that is defined by fscreen itself (6 possible string values instead of just `string`), and the  optional options parameter should be of type `boolean` or `AddEventListenerOptions` instead of `boolean` only.
This commit is contained in:
Terry Mun
2018-08-17 11:24:57 +02:00
parent f613e9716d
commit bf4d3186fd
+3 -2
View File
@@ -5,6 +5,7 @@
type Handler = () => void;
type RequestFullScreenFunction = (element: Element) => void;
type EventName = 'fullscreenEnabled' | 'fullscreenElement' | 'requestFullscreen' | 'exitFullscreen' | 'fullscreenchange' | 'fullscreenerror';
declare class Fscreen {
readonly fullscreenElement: Element | undefined;
@@ -13,8 +14,8 @@ declare class Fscreen {
onfullscreenchange: Handler;
onfullscreenerror: Handler;
addEventListener(type: string, handler: Handler, useCapture?: boolean): void;
removeEventListener(type: string, handler: Handler): void;
addEventListener(type: EventName, handler: Handler, options?: boolean | AddEventListenerOptions): void;
removeEventListener(type: EventName, handler: Handler, options?: boolean | AddEventListenerOptions): void;
requestFullscreen(element: Element): void;
requestFullscreenFunction(element: Element): RequestFullScreenFunction;
}