Add jquery-match-height typings

This commit is contained in:
Andrea Briganti
2017-05-24 16:25:53 +02:00
parent e63f331400
commit 5b4c1f8832
3 changed files with 88 additions and 0 deletions

29
types/jquery-match-height/index.d.ts vendored Normal file
View File

@@ -0,0 +1,29 @@
// Type definitions for jquery-match-height v0.7.2
// Project: https://github.com/liabru/jquery-match-height
// Definitions by: Andrea Briganti <https://github.com/kbytesys/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="jquery"/>
// We cannot add the jQuery.fn definitions of the plugin until this
// issue is resolved
// https://github.com/DefinitelyTyped/DefinitelyTyped/issues/12685
declare namespace JQueryMatchHeight {
interface Options {
byRow?: boolean,
property?: string,
target?: string,
remove?: boolean
}
}
interface JQuery {
/**
* Set all selected elements to the height of the tallest.
* If the items are on multiple rows, the items of each row will be set to the tallest of that row.
*
* @param options
*/
matchHeight(options?: JQueryMatchHeight.Options): JQuery;
}

View File

@@ -0,0 +1,36 @@
/* from documentation at https://github.com/liabru/jquery-match-height */
$(document).ready(() => {
$(".containers").matchHeight();
$(".containers").matchHeight({
byRow: true,
property: "height",
target: null,
remove: true}
);
});
$.fn.matchHeight._update();
$.fn.matchHeight._rows($('.containers'));
$('.containers').matchHeight({ remove: true });
$.fn.matchHeight._beforeUpdate = function(event: any, groups: any) {
// do something before any updates are applied
};
$.fn.matchHeight._afterUpdate = function(event: any, groups: any) {
// do something after all updates are applied
};
let elements = $('.containers');
let options = {byRow: true};
$.fn.matchHeight._apply(elements, options);
$.fn.matchHeight._throttle = 80;
$.fn.matchHeight._maintainScroll = true;
$.fn.matchHeight._groups

View File

@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"jquery-match-height-tests.ts"
]
}