mirror of
https://github.com/videojs/video.js.git
synced 2024-11-24 08:42:25 +02:00
fix(types): improves quality of typescript definitions (#8218)
* feat(types): improves quality of typescript definitions * fix: reverts back access modifier for controlText_ * empty commit to force retest * fix(doc): add missing keyboard event type --------- Co-authored-by: mister-ben <git@misterben.me>
This commit is contained in:
parent
9267c46576
commit
781eb436e3
@ -36,7 +36,7 @@ class BigPlayButton extends Button {
|
|||||||
* This gets called when a `BigPlayButton` "clicked". See {@link ClickableComponent}
|
* This gets called when a `BigPlayButton` "clicked". See {@link ClickableComponent}
|
||||||
* for more detailed information on what a click can be.
|
* for more detailed information on what a click can be.
|
||||||
*
|
*
|
||||||
* @param {KeyboardEvent} event
|
* @param {KeyboardEvent|MouseEvent|TouchEvent} event
|
||||||
* The `keydown`, `tap`, or `click` event that caused this function to be
|
* The `keydown`, `tap`, or `click` event that caused this function to be
|
||||||
* called.
|
* called.
|
||||||
*
|
*
|
||||||
@ -47,7 +47,7 @@ class BigPlayButton extends Button {
|
|||||||
const playPromise = this.player_.play();
|
const playPromise = this.player_.play();
|
||||||
|
|
||||||
// exit early if clicked via the mouse
|
// exit early if clicked via the mouse
|
||||||
if (this.mouseused_ && event.clientX && event.clientY) {
|
if (this.mouseused_ && 'clientX' in event && 'clientY' in event) {
|
||||||
silencePromise(playPromise);
|
silencePromise(playPromise);
|
||||||
|
|
||||||
if (this.player_.tech(true)) {
|
if (this.player_.tech(true)) {
|
||||||
@ -74,12 +74,29 @@ class BigPlayButton extends Button {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Event handler that is called when a `BigPlayButton` receives a
|
||||||
|
* `keydown` event.
|
||||||
|
*
|
||||||
|
* @param {KeyboardEvent} event
|
||||||
|
* The `keydown` event that caused this function to be called.
|
||||||
|
*
|
||||||
|
* @listens keydown
|
||||||
|
*/
|
||||||
handleKeyDown(event) {
|
handleKeyDown(event) {
|
||||||
this.mouseused_ = false;
|
this.mouseused_ = false;
|
||||||
|
|
||||||
super.handleKeyDown(event);
|
super.handleKeyDown(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle `mousedown` events on the `BigPlayButton`.
|
||||||
|
*
|
||||||
|
* @param {MouseEvent} event
|
||||||
|
* `mousedown` or `touchstart` event that triggered this function
|
||||||
|
*
|
||||||
|
* @listens mousedown
|
||||||
|
*/
|
||||||
handleMouseDown(event) {
|
handleMouseDown(event) {
|
||||||
this.mouseused_ = true;
|
this.mouseused_ = true;
|
||||||
}
|
}
|
||||||
|
@ -106,7 +106,7 @@ class Button extends ClickableComponent {
|
|||||||
* This gets called when a `Button` has focus and `keydown` is triggered via a key
|
* This gets called when a `Button` has focus and `keydown` is triggered via a key
|
||||||
* press.
|
* press.
|
||||||
*
|
*
|
||||||
* @param {Event} event
|
* @param {KeyboardEvent} event
|
||||||
* The event that caused this function to get called.
|
* The event that caused this function to get called.
|
||||||
*
|
*
|
||||||
* @listens keydown
|
* @listens keydown
|
||||||
|
@ -233,7 +233,7 @@ class ClickableComponent extends Component {
|
|||||||
*
|
*
|
||||||
* By default, if the key is Space or Enter, it will trigger a `click` event.
|
* By default, if the key is Space or Enter, it will trigger a `click` event.
|
||||||
*
|
*
|
||||||
* @param {Event} event
|
* @param {KeyboardEvent} event
|
||||||
* The `keydown` event that caused this function to be called.
|
* The `keydown` event that caused this function to be called.
|
||||||
*
|
*
|
||||||
* @listens keydown
|
* @listens keydown
|
||||||
|
@ -71,7 +71,7 @@ class CloseButton extends Button {
|
|||||||
*
|
*
|
||||||
* By default, if the key is Esc, it will trigger a `click` event.
|
* By default, if the key is Esc, it will trigger a `click` event.
|
||||||
*
|
*
|
||||||
* @param {Event} event
|
* @param {KeyboardEvent} event
|
||||||
* The `keydown` event that caused this function to be called.
|
* The `keydown` event that caused this function to be called.
|
||||||
*
|
*
|
||||||
* @listens keydown
|
* @listens keydown
|
||||||
|
@ -1324,7 +1324,7 @@ class Component {
|
|||||||
* delegates to `handleKeyDown`. This means anyone calling `handleKeyPress`
|
* delegates to `handleKeyDown`. This means anyone calling `handleKeyPress`
|
||||||
* will not see their method calls stop working.
|
* will not see their method calls stop working.
|
||||||
*
|
*
|
||||||
* @param {Event} event
|
* @param {KeyboardEvent} event
|
||||||
* The event that caused this function to be called.
|
* The event that caused this function to be called.
|
||||||
*/
|
*/
|
||||||
handleKeyPress(event) {
|
handleKeyPress(event) {
|
||||||
@ -1336,7 +1336,7 @@ class Component {
|
|||||||
* support toggling the controls through a tap on the video. They get enabled
|
* support toggling the controls through a tap on the video. They get enabled
|
||||||
* because every sub-component would have extra overhead otherwise.
|
* because every sub-component would have extra overhead otherwise.
|
||||||
*
|
*
|
||||||
* @private
|
* @protected
|
||||||
* @fires Component#tap
|
* @fires Component#tap
|
||||||
* @listens Component#touchstart
|
* @listens Component#touchstart
|
||||||
* @listens Component#touchmove
|
* @listens Component#touchmove
|
||||||
|
@ -88,7 +88,7 @@ class MenuItem extends ClickableComponent {
|
|||||||
* Ignore keys which are used by the menu, but pass any other ones up. See
|
* Ignore keys which are used by the menu, but pass any other ones up. See
|
||||||
* {@link ClickableComponent#handleKeyDown} for instances where this is called.
|
* {@link ClickableComponent#handleKeyDown} for instances where this is called.
|
||||||
*
|
*
|
||||||
* @param {Event} event
|
* @param {KeyboardEvent} event
|
||||||
* The `keydown` event that caused this function to be called.
|
* The `keydown` event that caused this function to be called.
|
||||||
*
|
*
|
||||||
* @listens keydown
|
* @listens keydown
|
||||||
|
@ -205,7 +205,7 @@ class Menu extends Component {
|
|||||||
/**
|
/**
|
||||||
* Handle a `keydown` event on this menu. This listener is added in the constructor.
|
* Handle a `keydown` event on this menu. This listener is added in the constructor.
|
||||||
*
|
*
|
||||||
* @param {Event} event
|
* @param {KeyboardEvent} event
|
||||||
* A `keydown` event that happened on the menu.
|
* A `keydown` event that happened on the menu.
|
||||||
*
|
*
|
||||||
* @listens keydown
|
* @listens keydown
|
||||||
|
@ -3164,7 +3164,7 @@ class Player extends Component {
|
|||||||
* This allows player-wide hotkeys (either as defined below, or optionally
|
* This allows player-wide hotkeys (either as defined below, or optionally
|
||||||
* by an external function).
|
* by an external function).
|
||||||
*
|
*
|
||||||
* @param {Event} event
|
* @param {KeyboardEvent} event
|
||||||
* The `keydown` event that caused this function to be called.
|
* The `keydown` event that caused this function to be called.
|
||||||
*
|
*
|
||||||
* @listens keydown
|
* @listens keydown
|
||||||
|
@ -64,7 +64,7 @@ function _cleanUpEvents(elem, type) {
|
|||||||
* @param {Element|Object} elem
|
* @param {Element|Object} elem
|
||||||
* Element or object to bind listeners to
|
* Element or object to bind listeners to
|
||||||
*
|
*
|
||||||
* @param {string} type
|
* @param {string[]} types
|
||||||
* Type of event to bind to.
|
* Type of event to bind to.
|
||||||
*
|
*
|
||||||
* @param {Function} callback
|
* @param {Function} callback
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
"include": ["src/js/**/*"],
|
"include": ["src/js/**/*"],
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"allowJs": true,
|
"allowJs": true,
|
||||||
|
"allowSyntheticDefaultImports": true,
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
"emitDeclarationOnly": true,
|
"emitDeclarationOnly": true,
|
||||||
"outDir": "dist/types",
|
"outDir": "dist/types",
|
||||||
|
Loading…
Reference in New Issue
Block a user