Added definitions for clusterize.js (#20738)

* Added definitions for clusterize.js

* Fixed definitions author.

* Review fixes.

* Review fix.
This commit is contained in:
Philipp Shestakov
2017-10-20 07:25:57 -07:00
committed by Andy
parent 7239c6a38d
commit 490c4210d6
4 changed files with 85 additions and 0 deletions
@@ -0,0 +1,20 @@
import Clusterize = require('clusterize.js');
const options: Clusterize.Options = { contentId: '', scrollId: '' };
const clusterize = new Clusterize(options);
clusterize.append(['<li></li>']);
clusterize.prepend(['<li></li>']);
clusterize.getRowsAmount();
clusterize.update(['<li></li>']);
clusterize.getScrollProgress();
clusterize.refresh();
clusterize.clear();
clusterize.destroy();
+41
View File
@@ -0,0 +1,41 @@
// Type definitions for clusterize.js 0.17
// Project: https://github.com/NeXTs/Clusterize.js
// Definitions by: Pr1st0n <https://github.com/Pr1st0n>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare class Clusterize {
constructor(options: Clusterize.Options);
destroy(clean?: boolean): void;
refresh(force?: boolean): void;
clear(): void;
getRowsAmount(): number;
getScrollProgress(): number;
update(data?: string[]): void;
append(rows: string[]): void;
prepend(rows: string[]): void;
}
declare namespace Clusterize {
interface Options {
scrollId: string;
contentId: string;
rows?: string[];
tag?: string;
rows_in_block?: number;
blocks_in_cluster?: number;
show_no_data_row?: boolean;
no_data_text?: string;
no_data_class?: string;
keep_parity?: boolean;
callbacks?: Callbacks;
}
interface Callbacks {
clusterWillChange?(cb: () => void): void;
clusterChanged?(cb: () => void): void;
scrollingProgress?(cb: (progress: number) => void): void;
}
}
export = Clusterize;
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"clusterize.js-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }