• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

marekdedic / imagelightbox / 11200566870

06 Oct 2024 09:04AM UTC coverage: 86.168% (-0.4%) from 86.56%
11200566870

Pull #1113

github

marekdedic
Only autoplaying videos after they've benn fully loaded and transitioned in
Pull Request #1113: Only autoplaying videos after they've been fully loaded and transitioned in

102 of 142 branches covered (71.83%)

1 of 12 new or added lines in 3 files covered. (8.33%)

380 of 441 relevant lines covered (86.17%)

160.28 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

87.5
/src/lib/VideoCache.ts
1
import type { VideoOptions } from "./interfaces/VideoOptions";
2

3
import { PreloadedVideo } from "./PreloadedVideo";
4

5
export interface VideoCache {
6
  add(elements: Array<HTMLAnchorElement>): void;
7
  get(videoId: string): PreloadedVideo | undefined;
8
}
9

10
export function VideoCache(): VideoCache {
11
  const videos: Array<PreloadedVideo> = [];
951✔
12

13
  function add(elements: Array<HTMLAnchorElement>): void {
14
    for (const image of elements) {
954✔
15
      const videoOptions = image.dataset["ilb2Video"];
2,676✔
16
      if (videoOptions === undefined) {
2,676✔
17
        continue;
2,619✔
18
      }
19
      videos.push(
57✔
20
        PreloadedVideo(image, JSON.parse(videoOptions) as VideoOptions),
21
      );
22
    }
23
  }
24

25
  function get(videoId: string): PreloadedVideo | undefined {
NEW
26
    return videos.find((x) => x.id() === videoId);
×
27
  }
28

29
  return {
951✔
30
    add,
31
    get,
32
  };
33
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc