Skip to content

Commit

Permalink
Improve check for boolean in ping config type checking
Browse files Browse the repository at this point in the history
  • Loading branch information
matus-tomlein committed Apr 25, 2023
1 parent 861e96e commit 6459342
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions plugins/browser-plugin-media/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,10 @@ export function startMediaTracking(
config: MediaTrackingConfiguration & CommonMediaEventProperties,
trackers: Array<string> = Object.keys(_trackers)
) {
const pingInterval =
config.pings === false ? undefined : config.pings === true ? undefined : config.pings?.pingInterval;

const maxPausedPings =
config.pings === false ? undefined : config.pings === true ? undefined : config.pings?.maxPausedPings;

const pingInterval = typeof config.pings === 'boolean' ? undefined : config.pings?.pingInterval;
const maxPausedPings = typeof config.pings === 'boolean' ? undefined : config.pings?.maxPausedPings;
const pings =
config.pings === false || config.pings == undefined
config.pings === false || config.pings === undefined
? undefined
: new MediaPingInterval(pingInterval, maxPausedPings, () => {
trackMediaEvent(MediaPlayerEventType.Ping, { id: config.id }, trackers);
Expand Down

0 comments on commit 6459342

Please sign in to comment.