Added definitions for clusterize.js

This commit is contained in:
pr1st0n
2017-10-19 22:06:32 +03:00
parent ba590380e1
commit c6343d34d8
4 changed files with 82 additions and 0 deletions
@@ -0,0 +1,19 @@
import Clusterize = require('clusterize.js');
const clusterize = new Clusterize({ contentId: '', scrollId: '' });
clusterize.append(['<li></li>']);
clusterize.prepend(['<li></li>']);
clusterize.getRowsAmount();
clusterize.update(['<li></li>']);
clusterize.getScrollProgress();
clusterize.refresh();
clusterize.clear();
clusterize.destroy();
+39
View File
@@ -0,0 +1,39 @@
// Type definitions for clusterize.js 0.17
// Project: https://github.com/NeXTs/Clusterize.js
// Definitions by: My Self <https://github.com/me>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare class Clusterize {
constructor(options: ClusterizeOptions);
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;
}
interface ClusterizeOptions {
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?: ClusterizeCallbacks;
}
interface ClusterizeCallbacks {
clusterWillChange?(cb: () => any): any;
clusterChanged?(cb: () => any): any;
scrollingProgress?(cb: (progress: number) => any): any;
}
export = Clusterize;
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": false,
"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" }