diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 0000000..b797c41 --- /dev/null +++ b/index.d.ts @@ -0,0 +1,36 @@ +import * as React from "react"; + +interface TrackVisibilityProps { + /** + * Define if the visibility need to be tracked once + */ + once?: boolean; + + /** + * Tweak the throttle interval + * Check https://css-tricks.com/debouncing-throttling-explained-examples/ for more details + */ + throttleInterval?: number; + + /** + * Additional style to apply + */ + style?: object; + + /** + * Additional className to apply + */ + className?: string; + + /** + * Define an offset. Can be useful for lazy loading + */ + offset?: number; + + /** + * Update the visibility state as soon as a part of the tracked component is visible + */ + partialVisibility?: boolean; +} + +export class TrackVisibility extends React.Component {} diff --git a/package.json b/package.json index 90eaef1..ffcd25e 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "screen" ], "main": "lib/index.js", + "typings": "./index.d.ts", "scripts": { "lint": "eslint src/", "pretest": "npm run lint",