Merge pull request #28191 from terrymun/master

[@types/fscreen] Improved typings for fscreen event listener handlers
This commit is contained in:
Daniel Rosenwasser
2018-08-24 16:14:33 -07:00
committed by GitHub
+8 -4
View File
@@ -1,9 +1,13 @@
// Type definitions for fscreen 1.0
// Project: https://github.com/rafrex/fscreen#readme
// Definitions by: Joscha Feth <https://github.com/joscha>
// Terry Mun <https://github.com/terrymun>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
type Handler = () => void;
type Handler = (e?: Event) => void;
type RequestFullScreenFunction = (element: Element) => void;
type EventName = 'fullscreenEnabled' | 'fullscreenElement' | 'requestFullscreen' | 'exitFullscreen' | 'fullscreenchange' | 'fullscreenerror';
declare class Fscreen {
readonly fullscreenElement: Element | undefined;
@@ -12,10 +16,10 @@ 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): void;
requestFullscreenFunction(element: Element): RequestFullScreenFunction;
}
declare const fscreen: Fscreen;