mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-17 22:44:18 +08:00
Merge pull request #19579 from alaz/picturefill
Type definitions for `picturefill`
This commit is contained in:
18
types/picturefill/index.d.ts
vendored
Normal file
18
types/picturefill/index.d.ts
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
// Type definitions for picturefill 3.0
|
||||
// Project: https://scottjehl.github.io/picturefill/
|
||||
// Definitions by: Alexander Azarov <https://github.com/alaz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace Picturefill {
|
||||
type ElementNullable = Element | null;
|
||||
|
||||
interface EvaluateArg {
|
||||
reevaluate?: boolean;
|
||||
elements: NodeList | ElementNullable[];
|
||||
}
|
||||
}
|
||||
|
||||
declare function picturefill(arg?: Picturefill.EvaluateArg): void;
|
||||
|
||||
export = picturefill;
|
||||
export as namespace picturefill;
|
||||
17
types/picturefill/picturefill-tests.ts
Normal file
17
types/picturefill/picturefill-tests.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
function test_elements() {
|
||||
// no args
|
||||
picturefill();
|
||||
|
||||
// Element[]
|
||||
picturefill({elements: [ document.getElementById('#id') ]});
|
||||
|
||||
// NodeList
|
||||
picturefill({elements: document.querySelectorAll('img')});
|
||||
}
|
||||
|
||||
function test_optional() {
|
||||
picturefill({
|
||||
elements: [],
|
||||
reevaluate: true
|
||||
});
|
||||
}
|
||||
23
types/picturefill/tsconfig.json
Normal file
23
types/picturefill/tsconfig.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"dom",
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"picturefill-tests.ts"
|
||||
]
|
||||
}
|
||||
3
types/picturefill/tslint.json
Normal file
3
types/picturefill/tslint.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Reference in New Issue
Block a user