Merge pull request #23491 from davidmpaz/stickem

Add type definitions for jquery-stickem package
This commit is contained in:
Daniel Rosenwasser
2018-02-13 11:20:30 -08:00
committed by GitHub
4 changed files with 100 additions and 0 deletions
+53
View File
@@ -0,0 +1,53 @@
// Type definitions for jquery.stickem.js 1.4
// Project: https://github.com/davist11/jQuery-Stickem
// Definitions by: David Paz <https://github.com/davidmpaz>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="jquery"/>
interface StickemSettings {
/**
* selector for element to make sticky
*/
item?: string;
/**
* selector for content container, sizes matched with `item`
*/
container?: string;
/**
* css class used to apply
*/
stickClass?: string;
/**
* css class used to apply when ending sticky
*/
endStickClass?: string;
/**
* offset to use for the sticky element in the parent element
*/
offset?: number | string;
/**
* where to place sticky element
*/
start?: number | string;
/**
* Callback to execute when in stick state
*/
onStick?: () => void;
/**
* Callback to execute when getting out of stick state
*/
onUnstick?: () => void;
}
interface JQuery {
stickem(settings?: StickemSettings): JQuery;
}
@@ -0,0 +1,19 @@
// without options
$('div').stickem();
jQuery('div').stickem();
// with options
$('div').stickem({item:
'.stickem',
container: '.stickem-container',
stickClass: 'stickit',
endStickClass: 'stickit-end'
});
jQuery('div').stickem({
item: '.stickem',
container: '.stickem-container',
stickClass: 'stickit',
endStickClass: 'stickit-end'
});
+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",
"jquery.stickem-tests.ts"
]
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}