Skip to content

Commit

Permalink
🤖 Merge PR DefinitelyTyped#69188 [jwplayer] Update registerPlugin t…
Browse files Browse the repository at this point in the history
…ypes by @amowu

Co-authored-by: codershiba <155646804+codershiba@users.noreply.github.com>
  • Loading branch information
amowu and codershiba committed Apr 12, 2024
1 parent b888d6c commit 4e11313
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
9 changes: 8 additions & 1 deletion types/jwplayer/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1482,6 +1482,9 @@ declare namespace jwplayer {
playbackRates?: number[];
playlist?: PlaylistItem[] | string;
playlistIndex?: number;
plugins?: {
[pluginUrl: string]: any;
};
preload?: Preload;
qualityLabels?: {
[bandwidth: number]: string;
Expand Down Expand Up @@ -1664,7 +1667,11 @@ declare namespace jwplayer {
playlistNext(): JWPlayer;
playlistPrev(): JWPlayer;
playToggle(): JWPlayer;
registerPlugin(id: string, target: string, jsPlugin: () => void, swfURL?: string): void;
registerPlugin(
pluginName: string,
playerMinimumVersion: string,
pluginClassOrFunction: (playerInstance: JWPlayer, pluginConfig: any, pluginDiv: HTMLElement) => void
): void;
remove(): JWPlayer;
removeButton(id: string): JWPlayer;
removePlaylistItemCallback(): void;
Expand Down
10 changes: 9 additions & 1 deletion types/jwplayer/jwplayer-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ const sliderCue: jwplayer.SliderCue = {
const config: jwplayer.SetupConfig = {
aspectratio: "16:9",
autostart: true,
plugins: {
"//myexample.com/jwplayer/scripts/sampleScript.js": {
sampleFunction: () => {
console.log('from plugin: hello world');
},
name: 'Dan Woon Acorn'
},
},
};

// $ExpectType JWPlayer
Expand Down Expand Up @@ -216,7 +224,7 @@ player.playAd("testTag");
player.playAd(["testTag", "testTag2", "testTag3"]);

// $ExpectType void
player.registerPlugin("testId", "testTarget", () => {});
player.registerPlugin("testPluginName", "testPlayerMinimumVersion", (playerInstance, pluginConfig, pluginDiv) => {});

// $ExpectType void
player.removePlaylistItemCallback();
Expand Down
2 changes: 1 addition & 1 deletion types/jwplayer/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@types/jwplayer",
"version": "8.28.9999",
"version": "8.31.9999",
"projects": [
"https://github.com/jwplayer/jwplayer"
],
Expand Down

0 comments on commit 4e11313

Please sign in to comment.