Skip to content

Commit fa221fd

Browse files
committed
upgrade to typescript
1 parent 0d72fa5 commit fa221fd

35 files changed

+3400
-1044
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
.DS_Store
22
node_modules
3+
testOutput

.prettierrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"printWidth": 100,
3+
"trailingComma": "es5",
4+
"singleQuote": true,
5+
"tabWidth": 4
6+
}

dist/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default scrollMonitor;

dist/index.js

Lines changed: 23 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/src/constants.d.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
export declare const VISIBILITYCHANGE = "visibilityChange";
2+
export declare const ENTERVIEWPORT = "enterViewport";
3+
export declare const FULLYENTERVIEWPORT = "fullyEnterViewport";
4+
export declare const EXITVIEWPORT = "exitViewport";
5+
export declare const PARTIALLYEXITVIEWPORT = "partiallyExitViewport";
6+
export declare const LOCATIONCHANGE = "locationChange";
7+
export declare const STATECHANGE = "stateChange";
8+
export declare const eventTypes: readonly ["visibilityChange", "enterViewport", "fullyEnterViewport", "exitViewport", "partiallyExitViewport", "locationChange", "stateChange"];
9+
export declare const isOnServer: boolean;
10+
export declare const isInBrowser: boolean;
11+
export declare const defaultOffsets: {
12+
readonly top: 0;
13+
readonly bottom: 0;
14+
};

dist/src/constants.js

Lines changed: 33 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/src/constants.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/src/container.d.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { Offsets, WatchItemInput, ScrollEvent } from './types.js';
2+
import Watcher from './watcher.js';
3+
declare class ScrollMonitorContainer {
4+
item: HTMLElement;
5+
watchers: Watcher[];
6+
viewportTop: number;
7+
viewportBottom: number;
8+
documentHeight: number;
9+
viewportHeight: number;
10+
contentHeight: number;
11+
containerWatcher: Watcher | undefined;
12+
update: () => void;
13+
recalculateLocations: () => void;
14+
eventTypes: readonly ["visibilityChange", "enterViewport", "fullyEnterViewport", "exitViewport", "partiallyExitViewport", "locationChange", "stateChange"];
15+
constructor(item: HTMLElement, parentWatcher?: ScrollMonitorContainer);
16+
listenToDOM(): void;
17+
destroy(): void;
18+
DOMListener(event: ScrollEvent): void;
19+
updateState(): void;
20+
updateAndTriggerWatchers(event: ScrollEvent): void;
21+
createContainer(input: HTMLElement | NodeList | HTMLElement[] | string): ScrollMonitorContainer;
22+
create(input: WatchItemInput, offsets?: Offsets): Watcher;
23+
/**
24+
* @deprecated since version 1.1
25+
*/
26+
beget(input: WatchItemInput, offsets?: Offsets): Watcher;
27+
}
28+
export default ScrollMonitorContainer;

dist/src/container.js

Lines changed: 242 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)