Merge pull request #8663 from schmidtk/ts-vendor-fullscreen
Add vendor-specific TS declarations for the Fullscreen API.
This commit is contained in:
@@ -34,9 +34,9 @@ const getChangeType = (function() {
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {string} [className='ol-full-screen'] CSS class name.
|
||||
* @property {string|HTMLElement} [label='\u2922'] Text label to use for the button.
|
||||
* @property {string|Text} [label='\u2922'] Text label to use for the button.
|
||||
* Instead of text, also an element (e.g. a `span` element) can be used.
|
||||
* @property {string|HTMLElement} [labelActive='\u00d7'] Text label to use for the
|
||||
* @property {string|Text} [labelActive='\u00d7'] Text label to use for the
|
||||
* button when full-screen is active.
|
||||
* Instead of text, also an element (e.g. a `span` element) can be used.
|
||||
* @property {string} [tipLabel='Toggle full-screen'] Text label to use for the button tip.
|
||||
@@ -87,7 +87,7 @@ class FullScreen extends Control {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {HTMLElement}
|
||||
* @type {Text}
|
||||
*/
|
||||
this.labelNode_ = typeof label === 'string' ?
|
||||
document.createTextNode(label) : label;
|
||||
@@ -96,7 +96,7 @@ class FullScreen extends Control {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {HTMLElement}
|
||||
* @type {Text}
|
||||
*/
|
||||
this.labelActiveNode_ = typeof labelActive === 'string' ?
|
||||
document.createTextNode(labelActive) : labelActive;
|
||||
@@ -253,7 +253,7 @@ function requestFullScreenWithKeys(element) {
|
||||
if (element.mozRequestFullScreenWithKeys) {
|
||||
element.mozRequestFullScreenWithKeys();
|
||||
} else if (element.webkitRequestFullscreen) {
|
||||
element.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);
|
||||
element.webkitRequestFullscreen();
|
||||
} else {
|
||||
requestFullScreen(element);
|
||||
}
|
||||
|
||||
@@ -55,6 +55,7 @@
|
||||
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
|
||||
},
|
||||
"include": [
|
||||
"types/**/*.ts",
|
||||
"src/ol/**/*.js"
|
||||
]
|
||||
}
|
||||
|
||||
29
types/dom.d.ts
vendored
Normal file
29
types/dom.d.ts
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* Type declarations extending TypeScript's lib/lib.dom.d.ts.
|
||||
* https://github.com/Microsoft/TypeScript/blob/master/lib/lib.dom.d.ts
|
||||
*/
|
||||
|
||||
interface Document {
|
||||
readonly mozFullScreen: boolean;
|
||||
readonly webkitIsFullScreen: boolean;
|
||||
|
||||
readonly fullscreenElement: Element;
|
||||
readonly mozFullScreenElement: Element;
|
||||
readonly msFullscreenElement: Element;
|
||||
readonly webkitFullscreenElement: Element;
|
||||
|
||||
readonly mozFullScreenEnabled: boolean;
|
||||
readonly msFullscreenEnabled: boolean;
|
||||
readonly webkitFullscreenEnabled: boolean;
|
||||
|
||||
mozCancelFullScreen(): void;
|
||||
msExitFullscreen(): void;
|
||||
webkitExitFullscreen(): void;
|
||||
}
|
||||
|
||||
interface Element {
|
||||
mozRequestFullScreen(): Promise<void>;
|
||||
mozRequestFullScreenWithKeys(): Promise<void>;
|
||||
msRequestFullscreen(): Promise<void>;
|
||||
webkitRequestFullscreen(allowKeyboardInput?: number): Promise<void>;
|
||||
}
|
||||
Reference in New Issue
Block a user