Skip to content

Commit

Permalink
While documenting realised that the timeStart argument to a progress …
Browse files Browse the repository at this point in the history
…callback is now too different, and that the activeCall argument was not listed in the typedef file.
  • Loading branch information
Rycochet committed Feb 1, 2018
1 parent 9bb49c9 commit 69c7e44
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ type VelocityCallback = (this: VelocityExtended & HTMLorSVGElement[], elements?:
/**
* A callback used for progress tracking.
*/
type VelocityProgress = (this: VelocityExtended & HTMLorSVGElement[], elements?: VelocityExtended & HTMLorSVGElement[], percentComplete?: number, remaining?: number, start?: number, tweenValue?: number) => void;
type VelocityProgress = (this: VelocityExtended & HTMLorSVGElement[], elements?: VelocityExtended & HTMLorSVGElement[], percentComplete?: number, remaining?: number, tweenValue?: number, activeCall?: AnimationCall) => void;

// TODO: Clean this up, add comments, remove deprecated options
interface VelocityOptions {
Expand Down
2 changes: 1 addition & 1 deletion src/Velocity/complete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace VelocityStatic {
try {
const elements = activeCall.elements;

activeCall.options.complete.call(elements, elements, activeCall);
(activeCall.options.complete as VelocityCallback).call(elements, elements, activeCall);
} catch (error) {
setTimeout(function() {
throw error;
Expand Down
6 changes: 2 additions & 4 deletions src/Velocity/tick.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace VelocityStatic {
try {
const elements = activeCall.elements;

activeCall.options.begin.call(elements, elements, activeCall);
(activeCall.options.begin as VelocityCallback).call(elements, elements, activeCall);
} catch (error) {
setTimeout(function() {
throw error;
Expand All @@ -36,14 +36,12 @@ namespace VelocityStatic {
options = activeCall.options,
tweenValue = activeCall.tween;

activeCall.options.progress.call(elements,
(activeCall.options.progress as VelocityProgress).call(elements,
elements,
percentComplete,
Math.max(0, activeCall.timeStart + (activeCall.duration != null ? activeCall.duration : options.duration != null ? options.duration : defaults.duration) - timeCurrent),
activeCall.timeStart,
tweenValue !== undefined ? tweenValue : String(percentComplete * 100),
activeCall);

} catch (error) {
setTimeout(function() {
throw error;
Expand Down
2 changes: 1 addition & 1 deletion velocity.js
Original file line number Diff line number Diff line change
Expand Up @@ -3243,7 +3243,7 @@ var VelocityStatic;
function callProgress(activeCall, timeCurrent) {
try {
var elements = activeCall.elements, percentComplete = activeCall.percentComplete, options = activeCall.options, tweenValue = activeCall.tween;
activeCall.options.progress.call(elements, elements, percentComplete, Math.max(0, activeCall.timeStart + (activeCall.duration != null ? activeCall.duration : options.duration != null ? options.duration : VelocityStatic.defaults.duration) - timeCurrent), activeCall.timeStart, tweenValue !== undefined ? tweenValue : String(percentComplete * 100), activeCall);
activeCall.options.progress.call(elements, elements, percentComplete, Math.max(0, activeCall.timeStart + (activeCall.duration != null ? activeCall.duration : options.duration != null ? options.duration : VelocityStatic.defaults.duration) - timeCurrent), tweenValue !== undefined ? tweenValue : String(percentComplete * 100), activeCall);
} catch (error) {
setTimeout(function() {
throw error;
Expand Down
2 changes: 1 addition & 1 deletion velocity.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions velocity.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion velocity.ui.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 69c7e44

Please sign in to comment.