Skip to content

Commit

Permalink
fix: Check version
Browse files Browse the repository at this point in the history
  • Loading branch information
vlazh committed Oct 18, 2024
1 parent cfc1932 commit d64207d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ function loadScript(url: string, isExecuted?: () => boolean): Promise<void> {

export type IframeApiVersion = 'latest' | `v2.${number}.${number}` | `2.${number}.${number}`;

function normalizeVersion(version: IframeApiVersion): string {
if (version === 'latest' || version[0] === 'v') return version;
return `v${version}`;
function normalizeVersion(version: string): IframeApiVersion {
if (version === 'latest' || version[0] === 'v') return version as IframeApiVersion;
return `v${version}` as IframeApiVersion;
}

/**
Expand All @@ -76,7 +76,7 @@ export async function load(
if (window.Kinescope?.IframePlayer) {
if (typeof version === 'string') {
const normVersion = normalizeVersion(version);
const prevVersion = window.Kinescope.IframePlayer.version;
const prevVersion = normalizeVersion(window.Kinescope.IframePlayer.version);
const isAnotherVersion =
normVersion === 'latest'
? (window.Kinescope.IframePlayer as any).isLatestVersion === false
Expand Down

0 comments on commit d64207d

Please sign in to comment.