Skip to content

Commit

Permalink
fix(types): use typeof for registerComponent and registerPlugin (#8451)
Browse files Browse the repository at this point in the history
* use typeof for registerComponent|Plugin

* separate out addChild changes
  • Loading branch information
mister-ben authored Oct 3, 2023
1 parent d1c3bd3 commit 2c36d25
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/js/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,6 @@ class Component {
/**
* Add a child `Component` inside the current `Component`.
*
*
* @param {string|Component} child
* The name or instance of a child to add.
*
Expand All @@ -593,6 +592,7 @@ class Component {
* @param {number} [index=this.children_.length]
* The index to attempt to add a child into.
*
*
* @return {Component}
* The `Component` that gets added as a child. When using a string the
* `Component` will get created by this process.
Expand Down
4 changes: 2 additions & 2 deletions src/js/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,8 @@ const DEFAULT_BREAKPOINTS = {
*
* After an instance has been created it can be accessed globally in three ways:
* 1. By calling `videojs.getPlayer('example_video_1');`
* 2. By calling `videojs('example_video_1');` (not recomended)
* 2. By using it directly via `videojs.players.example_video_1;`
* 2. By calling `videojs('example_video_1');` (not recommended)
* 2. By using it directly via `videojs.players.example_video_1;`
*
* @extends Component
* @global
Expand Down
10 changes: 6 additions & 4 deletions src/js/video.js
Original file line number Diff line number Diff line change
Expand Up @@ -320,10 +320,10 @@ videojs.getComponent = Component.getComponent;
* @param {string} name
* The class name of the component
*
* @param {Component} comp
* @param {typeof Component} comp
* The component class
*
* @return {Component}
* @return {typeof Component}
* The newly registered component
*/
videojs.registerComponent = (name, comp) => {
Expand Down Expand Up @@ -410,9 +410,11 @@ videojs.deregisterPlugin = Plugin.deregisterPlugin;
*
* @param {string} name
* The plugin name
*
* @param {Plugin|Function} plugin
*
* @param {typeof Plugin|Function} plugin
* The plugin sub-class or function
*
* @return {typeof Plugin|Function}
*/
videojs.plugin = (name, plugin) => {
log.warn('videojs.plugin() is deprecated; use videojs.registerPlugin() instead');
Expand Down

0 comments on commit 2c36d25

Please sign in to comment.