react-scrubber
Advanced tools
Comparing version 0.2.0 to 0.2.1
import React, { Component } from 'react'; | ||
import './scrubber.css'; | ||
export declare type ScrubberProps = { | ||
className: string; | ||
className?: string; | ||
value: number; | ||
min: number; | ||
max: number; | ||
bufferPosition: number; | ||
onScrubStart: (value: number) => void; | ||
onScrubEnd: (value: number) => void; | ||
onScrubChange: (value: number) => void; | ||
bufferPosition?: number; | ||
onScrubStart?: (value: number) => void; | ||
onScrubEnd?: (value: number) => void; | ||
onScrubChange?: (value: number) => void; | ||
}; | ||
@@ -13,0 +13,0 @@ declare type Nullable<T> = T | null; |
@@ -53,3 +53,3 @@ "use strict"; | ||
_this.setState({ mouseX: e.pageX }, function () { | ||
if (_this.state.seeking) { | ||
if (_this.state.seeking && _this.props.onScrubChange) { | ||
_this.props.onScrubChange(_this.getPositionFromMouseX()); | ||
@@ -63,3 +63,3 @@ } | ||
_this.setState({ touchX: touch.pageX }, function () { | ||
if (_this.state.seeking) { | ||
if (_this.state.seeking && _this.props.onScrubChange) { | ||
_this.props.onScrubChange(_this.getPositionFromMouseX()); | ||
@@ -72,3 +72,5 @@ } | ||
_this.setState({ seeking: true, mouseX: e.pageX }, function () { | ||
_this.props.onScrubStart(_this.getPositionFromMouseX()); | ||
if (_this.props.onScrubStart) { | ||
_this.props.onScrubStart(_this.getPositionFromMouseX()); | ||
} | ||
}); | ||
@@ -79,3 +81,5 @@ }; | ||
_this.setState({ hover: true, seeking: true, touchId: touch.identifier, touchX: touch.pageX }, function () { | ||
_this.props.onScrubStart(_this.getPositionFromMouseX()); | ||
if (_this.props.onScrubStart) { | ||
_this.props.onScrubStart(_this.getPositionFromMouseX()); | ||
} | ||
}); | ||
@@ -85,3 +89,5 @@ }; | ||
if (_this.state.seeking) { | ||
_this.props.onScrubEnd(_this.getPositionFromMouseX()); | ||
if (_this.props.onScrubEnd) { | ||
_this.props.onScrubEnd(_this.getPositionFromMouseX()); | ||
} | ||
_this.setState({ seeking: false, mouseX: null }); | ||
@@ -93,3 +99,5 @@ } | ||
if (touch && _this.state.seeking) { | ||
_this.props.onScrubEnd(_this.getPositionFromMouseX()); | ||
if (_this.props.onScrubEnd) { | ||
_this.props.onScrubEnd(_this.getPositionFromMouseX()); | ||
} | ||
_this.setState({ hover: false, seeking: false, touchX: null, touchId: null }); | ||
@@ -96,0 +104,0 @@ } |
{ | ||
"name": "react-scrubber", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "React scrubber component with touch controls, styling, and lots event handlers", | ||
@@ -8,2 +8,3 @@ "main": "./dist/index.js", | ||
"build": "tsc", | ||
"postbuild": "find ./src -name '*.css' -type f -exec cp -P {} ./lib \\;", | ||
"prepublish": "yarn build", | ||
@@ -10,0 +11,0 @@ "test": "echo \"Error: no test specified\" && exit 1" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
22748
8
396
0