mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-17 22:44:18 +08:00
- Remove prefix `I` for interfaces as suggested by reviewer - Remove NodeList type for success function parameter since it's not relevant
45 lines
904 B
TypeScript
45 lines
904 B
TypeScript
/// <reference path="blazy.d.ts" />
|
|
|
|
/* Constructor test */
|
|
var tester: BlazyInstance = new Blazy({
|
|
breakpoints: [
|
|
{
|
|
width: 420,
|
|
src: 'data-src-small'
|
|
},
|
|
{
|
|
width: 768,
|
|
src: 'data-src-medium'
|
|
}
|
|
],
|
|
container: '#scrolling-container',
|
|
error: function(ele: HTMLElement, msg: string) {
|
|
if (msg === 'missing') {
|
|
console.log('missing');
|
|
}
|
|
else if (msg === 'invalid') {
|
|
console.log('invalid');
|
|
}
|
|
},
|
|
errorClass: 'b-error',
|
|
loadInvisible: false,
|
|
offset: 100,
|
|
saveViewportOffsetDelay: 50,
|
|
selector: '.b-lazy',
|
|
separator: '|',
|
|
src: 'data-src',
|
|
success: function(ele: HTMLElement) {
|
|
console.log('success');
|
|
},
|
|
successClass: 'b-loaded',
|
|
validateDelay: 25
|
|
});
|
|
|
|
/* Functions tests */
|
|
tester.revalidate();
|
|
|
|
var elements = <NodeList>document.getElementsByTagName('img');
|
|
tester.load(elements, true);
|
|
|
|
tester.destroy();
|