Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for -1 timeout and backgroundTimeout values #206

Merged
merged 6 commits into from
May 4, 2021

Conversation

roman-bc-dev
Copy link
Contributor

Add support for -1 value, in addition to Infinity, to disable timeout and backgroundTimeout features.

src/plugin.js Outdated Show resolved Hide resolved
Copy link
Contributor

@brandonocasey brandonocasey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IE 11 doesn't support Array#includes and since we have to support it for a couple more months I think we should switch this to Array#some

@misteroneill
Copy link
Member

We can ignore the Snyk integration for this PR and merge it once approved. We'll keep Travis for now until we have a chance to migrate to GitHub Actions.

@gkatsev
Copy link
Member

gkatsev commented May 3, 2021

@roman-bc-dev were you using node 14 for this? Is that why the package-lock changed? If so, can we update the .nvmrc file to read lts/fermium?

@alex-barstow
Copy link
Contributor

alex-barstow commented May 3, 2021

We've also used .indexOf() as an alternative to .includes() in the past: disableValues.indexOf(options.backgroundTimeout) !== -1

Edit: but seems like consensus supports using .some() in this case :)

@@ -107,9 +107,12 @@ const initPlugin = function(player, options) {
// Disable timeouts in the background altogether according to the backgroundTimeout
// option, or if the player is muted, as browsers may throttle javascript timers to
// 1 minute in that case
const disableValues = [Infinity, -1];
const disableValueMatch = (valArray, option) => valArray.indexOf(option) !== -1;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Went with indexOf since it seemed a bit more lithe than .some() in this case.

@roman-bc-dev roman-bc-dev merged commit cf0ea56 into master May 4, 2021
@roman-bc-dev roman-bc-dev deleted the background-timeout-update branch May 4, 2021 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants