mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Add definitions for 'bricks.js'
This commit is contained in:
parent
78d81429f4
commit
64c8216c08
18
types/bricks.js/bricks.js-tests.ts
Normal file
18
types/bricks.js/bricks.js-tests.ts
Normal file
@ -0,0 +1,18 @@
|
||||
import Bricks from 'bricks.js';
|
||||
|
||||
const bricks = Bricks({
|
||||
container: document.body.firstChild!,
|
||||
packed: 'packed',
|
||||
sizes: [
|
||||
{ columns: 2, gutter: 10 },
|
||||
{ mq: '768px', columns: 3, gutter: 25 },
|
||||
{ mq: '1024px', columns: 4, gutter: 25 },
|
||||
]
|
||||
});
|
||||
|
||||
bricks
|
||||
.pack()
|
||||
.resize()
|
||||
.on('resize', (detail) => {
|
||||
const columns: number = detail.columns;
|
||||
});
|
||||
36
types/bricks.js/index.d.ts
vendored
Normal file
36
types/bricks.js/index.d.ts
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
// Type definitions for bricks.js 1.8
|
||||
// Project: https://github.com/callmecavs/bricks.js
|
||||
// Definitions by: Pusztai Tibor <https://github.com/kondi>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare function BricksFactory(options: BricksOptions): BricksInstance;
|
||||
|
||||
export interface BricksInstance {
|
||||
pack(): BricksInstance;
|
||||
update(): BricksInstance;
|
||||
resize(flag?: boolean): BricksInstance;
|
||||
|
||||
on(event: 'pack' | 'update', listener: () => any): BricksInstance;
|
||||
on(event: 'resize', listener: (sizeDetail: SizeDetail) => any): BricksInstance;
|
||||
|
||||
once(event: 'pack' | 'update', listener: () => any): BricksInstance;
|
||||
once(event: 'resize', listener: (sizeDetail: SizeDetail) => any): BricksInstance;
|
||||
|
||||
off(event: 'pack' | 'update', listener?: () => any): BricksInstance;
|
||||
off(event: 'resize', listener?: (sizeDetail: SizeDetail) => any): BricksInstance;
|
||||
}
|
||||
|
||||
export interface BricksOptions {
|
||||
container: Node | string;
|
||||
packed: string;
|
||||
sizes: SizeDetail[];
|
||||
position?: boolean;
|
||||
}
|
||||
|
||||
export interface SizeDetail {
|
||||
mq?: string;
|
||||
columns: number;
|
||||
gutter: number;
|
||||
}
|
||||
|
||||
export default BricksFactory;
|
||||
23
types/bricks.js/tsconfig.json
Normal file
23
types/bricks.js/tsconfig.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"bricks.js-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/bricks.js/tslint.json
Normal file
1
types/bricks.js/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user