1
0
mirror of https://github.com/videojs/video.js.git synced 2025-01-19 10:54:16 +02:00

fix(types): use typeof for registerComponent and registerPlugin (#8451)

* use typeof for registerComponent|Plugin

* separate out addChild changes
This commit is contained in:
mister-ben 2023-10-03 10:19:05 +02:00 committed by GitHub
parent d1c3bd32b6
commit 2c36d2542a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 7 deletions

View File

@ -582,7 +582,6 @@ class Component {
/** /**
* Add a child `Component` inside the current `Component`. * Add a child `Component` inside the current `Component`.
* *
*
* @param {string|Component} child * @param {string|Component} child
* The name or instance of a child to add. * The name or instance of a child to add.
* *
@ -593,6 +592,7 @@ class Component {
* @param {number} [index=this.children_.length] * @param {number} [index=this.children_.length]
* The index to attempt to add a child into. * The index to attempt to add a child into.
* *
*
* @return {Component} * @return {Component}
* The `Component` that gets added as a child. When using a string the * The `Component` that gets added as a child. When using a string the
* `Component` will get created by this process. * `Component` will get created by this process.

View File

@ -286,8 +286,8 @@ const DEFAULT_BREAKPOINTS = {
* *
* After an instance has been created it can be accessed globally in three ways: * After an instance has been created it can be accessed globally in three ways:
* 1. By calling `videojs.getPlayer('example_video_1');` * 1. By calling `videojs.getPlayer('example_video_1');`
* 2. By calling `videojs('example_video_1');` (not recomended) * 2. By calling `videojs('example_video_1');` (not recommended)
* 2. By using it directly via `videojs.players.example_video_1;` * 2. By using it directly via `videojs.players.example_video_1;`
* *
* @extends Component * @extends Component
* @global * @global

View File

@ -320,10 +320,10 @@ videojs.getComponent = Component.getComponent;
* @param {string} name * @param {string} name
* The class name of the component * The class name of the component
* *
* @param {Component} comp * @param {typeof Component} comp
* The component class * The component class
* *
* @return {Component} * @return {typeof Component}
* The newly registered component * The newly registered component
*/ */
videojs.registerComponent = (name, comp) => { videojs.registerComponent = (name, comp) => {
@ -410,9 +410,11 @@ videojs.deregisterPlugin = Plugin.deregisterPlugin;
* *
* @param {string} name * @param {string} name
* The plugin name * The plugin name
* *
* @param {Plugin|Function} plugin * @param {typeof Plugin|Function} plugin
* The plugin sub-class or function * The plugin sub-class or function
*
* @return {typeof Plugin|Function}
*/ */
videojs.plugin = (name, plugin) => { videojs.plugin = (name, plugin) => {
log.warn('videojs.plugin() is deprecated; use videojs.registerPlugin() instead'); log.warn('videojs.plugin() is deprecated; use videojs.registerPlugin() instead');