Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-jw-player

Package Overview
Dependencies
Maintainers
3
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-jw-player - npm Package Compare versions

Comparing version 1.8.0-alpha.4 to 1.8.0-alpha.5

22

dist/create-event-handlers/on-ad-time.js

@@ -7,4 +7,3 @@ "use strict";

function onAdTime(event) {
var _state$previousPositi = this.state.previousPositionInteger,
previousPositionInteger = _state$previousPositi === undefined ? 0 : _state$previousPositi;
var previousPositionInteger = this.state.previousPositionInteger;
var position = event.position;

@@ -18,20 +17,9 @@

var shouldUpdateState = false;
this.props.onEverySecond(currentPositionInteger);
if (currentPositionInteger === 0) {
shouldUpdateState = true;
}
if (currentPositionInteger > previousPositionInteger) {
this.props.onEverySecond(currentPositionInteger);
shouldUpdateState = true;
}
if (shouldUpdateState) {
this.setState({
previousPositionInteger: currentPositionInteger
});
}
this.setState({
previousPositionInteger: currentPositionInteger
});
}
exports.default = onAdTime;
{
"name": "react-jw-player",
"version": "1.8.0-alpha.4",
"version": "1.8.0-alpha.5",
"description": "A React component for launching JW Player instances on the client.",

@@ -5,0 +5,0 @@ "main": "dist/react-jw-player.js",

function onAdTime(event) {
const { previousPositionInteger = 0 } = this.state;
const { previousPositionInteger } = this.state;
const { position } = event;

@@ -10,20 +10,9 @@ const currentPositionInteger = Math.floor(position);

let shouldUpdateState = false;
this.props.onEverySecond(currentPositionInteger);
if (currentPositionInteger === 0) {
shouldUpdateState = true;
}
if (currentPositionInteger > previousPositionInteger) {
this.props.onEverySecond(currentPositionInteger);
shouldUpdateState = true;
}
if (shouldUpdateState) {
this.setState({
previousPositionInteger: currentPositionInteger,
});
}
this.setState({
previousPositionInteger: currentPositionInteger,
});
}
export default onAdTime;

@@ -32,3 +32,3 @@ import test from 'tape';

t.doesNotThrow(onAdTime.bind(null, mockEvent), 'it runs without error');
t.deepEqual(results.onEverySecondCallCount, 0, 'it does not invoke onEverySecond() prop on initial call');
t.deepEqual(results.onEverySecondCallCount, 1, 'it does invokes onEverySecond() prop on initial call');

@@ -38,3 +38,3 @@ mockEvent.position = 1;

t.doesNotThrow(onAdTime.bind(null, mockEvent), 'it runs without error one second later');
t.deepEqual(results.onEverySecondCallCount, 1, 'it invoke onEverySecond() prop at one second');
t.deepEqual(results.onEverySecondCallCount, 2, 'it invoke onEverySecond() prop at one second');
t.deepEqual(mockComponent.state.previousPositionInteger, 1, 'stores 1 as previous position');

@@ -45,3 +45,3 @@

t.doesNotThrow(onAdTime.bind(null, mockEvent), 'it runs without error one second later');
t.deepEqual(results.onEverySecondCallCount, 2, 'it invoke onEverySecond() prop at two seconds');
t.deepEqual(results.onEverySecondCallCount, 3, 'it invoke onEverySecond() prop at two seconds');
t.deepEqual(mockComponent.state.previousPositionInteger, 2, 'stores 2 as previous position');

@@ -48,0 +48,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc