From 23332fa2c8ca7c8dc9f9d7875d07000f8e878617 Mon Sep 17 00:00:00 2001 From: James Charlesworth Date: Tue, 5 Nov 2019 19:15:34 +0000 Subject: [PATCH] [jump.js] Add option for passing duration as a function (#40082) * Add option for passing duration as a function, it has been supported in jump.js just missing from typings https://github.com/callmecavs/jump.js/blob/master/src/jump.js#L133 * jump.js remove myself from the defitions by (also kick off another build) --- types/jump.js/index.d.ts | 2 +- types/jump.js/jump.js-tests.ts | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/types/jump.js/index.d.ts b/types/jump.js/index.d.ts index 5c811d8656..6c7a0e9d7d 100644 --- a/types/jump.js/index.d.ts +++ b/types/jump.js/index.d.ts @@ -10,7 +10,7 @@ declare function jump(target: string | Element | number, opts?: jump.Options): v declare namespace jump { type TransitionFunc = (t: number, b: number, c: number, d: number) => number; interface Options { - duration?: number; + duration?: number | ((distance: number) => number); offset?: number; callback?(): void; easing?: TransitionFunc; diff --git a/types/jump.js/jump.js-tests.ts b/types/jump.js/jump.js-tests.ts index bce5d68f21..1f2d67deaf 100644 --- a/types/jump.js/jump.js-tests.ts +++ b/types/jump.js/jump.js-tests.ts @@ -6,6 +6,9 @@ jump('.target'); jump('.target', { duration: 1000, }); +jump('.target', { + duration: distance => Math.abs(distance) +}); jump('.target', { duration: 200, offset: 10