mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-12 21:10:23 +00:00
Type definitions for picturefill
It's a module function, so should be imported like
```
import picturefill = require('picturefill');
```
This commit is contained in:
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
// 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;
|
||||
|
||||
declare module 'picturefill' {
|
||||
export = picturefill;
|
||||
}
|
||||
@@ -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
|
||||
});
|
||||
}
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"no-single-declare-module": false
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user