Types for Nivo-Slider

This commit is contained in:
AndersonFriaca
2018-03-18 11:41:46 -04:00
parent e8bc07e649
commit 4a0594d983
4 changed files with 88 additions and 0 deletions
+39
View File
@@ -0,0 +1,39 @@
// Type definitions for Nivo Slider 3.2
// Project: https://github.com/Codeinwp/Nivo-Slider-jQuery
// Definitions by: Anderson Friaça <https://github.com/AndersonFriaca>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="jquery" />
export type EffectType = 'sliceDown' | 'sliceDownLeft' | 'sliceUp' | 'sliceUpLeft' | 'sliceUpDown' | 'sliceUpDownLeft' |
'fold' | 'fade' | 'random' | 'slideInRight' | 'slideInLeft' | 'boxRandom' | 'boxRain' | 'boxRainReverse' |
'boxRainGrow' | 'boxRainGrowReverse';
export interface Options {
effect?: EffectType;
slices?: number;
boxCols?: number;
boxRows?: number;
animSpeed?: number;
pauseTime?: number;
startSlide?: number;
directionNav?: boolean;
controlNav?: boolean;
controlNavThumbs?: boolean;
pauseOnHover?: boolean;
manualAdvance?: boolean;
prevText?: string;
nextText?: string;
randomStart?: boolean;
beforeChange?: () => void;
afterChange?: () => void;
slideshowEnd?: () => void;
lastSlide?: () => void;
afterLoad?: () => void;
}
declare global {
interface JQuery {
nivoSlider(options?: Options): JQuery;
}
}
+23
View File
@@ -0,0 +1,23 @@
import { Options } from "nivo-slider";
// basic usage
$('#slider').nivoSlider();
// with options
const options: Options = {
effect: 'random',
slices: 15,
boxCols: 8,
boxRows: 4,
animSpeed: 500,
pauseTime: 3000,
startSlide: 0,
directionNav: true,
controlNav: true,
controlNavThumbs: false,
pauseOnHover: true,
manualAdvance: false,
prevText: 'Prev',
nextText: 'Next'
};
$('#slider').nivoSlider(options);
+25
View File
@@ -0,0 +1,25 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"esModuleInterop": true
},
"files": [
"index.d.ts",
"nivo-slider-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{"extends": "dtslint/dt.json"}