From db23448a5d67585098041dd585ddca1db5fe42bf Mon Sep 17 00:00:00 2001 From: Linda_pp Date: Fri, 20 Jan 2017 14:50:30 +0900 Subject: [PATCH] Add 'jump.js' module (#14129) --- jump.js/index.d.ts | 16 ++++++++++++++++ jump.js/jump.js-tests.ts | 16 ++++++++++++++++ jump.js/tsconfig.json | 20 ++++++++++++++++++++ jump.js/tslint.json | 1 + 4 files changed, 53 insertions(+) create mode 100644 jump.js/index.d.ts create mode 100644 jump.js/jump.js-tests.ts create mode 100644 jump.js/tsconfig.json create mode 100644 jump.js/tslint.json diff --git a/jump.js/index.d.ts b/jump.js/index.d.ts new file mode 100644 index 0000000000..fdef97c712 --- /dev/null +++ b/jump.js/index.d.ts @@ -0,0 +1,16 @@ +// Type definitions for jump.js 1.0 +// Project: https://github.com/callmecavs/jump.js +// Definitions by: rhysd +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare type TransitionFunc = (t: number, b: number, c: number, d: number) => number; +declare interface JumpOptions { + duration?: number; + offset?: number; + callback?: () => void; + easing?: TransitionFunc; + a11y?: boolean; +} +declare type Jump = (target: string | Element | number, opts?: JumpOptions) => void; +declare const jump: Jump; +export = jump; diff --git a/jump.js/jump.js-tests.ts b/jump.js/jump.js-tests.ts new file mode 100644 index 0000000000..4ae48074b2 --- /dev/null +++ b/jump.js/jump.js-tests.ts @@ -0,0 +1,16 @@ +import jump = require('jump.js'); + +const node = document.querySelector('.target'); +jump(node); +jump('.target'); +jump('.target', { + duration: 1000, +}); +jump('.target', { + duration: 200, + offset: 10 +}); +jump(100); +jump(-100, { + callback: () => { console.log('Done!') } +}); diff --git a/jump.js/tsconfig.json b/jump.js/tsconfig.json new file mode 100644 index 0000000000..0c6ab6d7c8 --- /dev/null +++ b/jump.js/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "jump.js-tests.ts" + ] +} diff --git a/jump.js/tslint.json b/jump.js/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/jump.js/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" }