(img, feedDirection)
| 116 | } |
| 117 | |
| 118 | async updateWithNewImage(img, feedDirection) { |
| 119 | // No-op if lightbox is not open |
| 120 | if (this.el.style.display === "none" || this.el.style.opacity === "0") return; |
| 121 | |
| 122 | // Ensure currently shown image does not change |
| 123 | const [method, shift] = feedDirection === "newest first" ? ["unshift", 1] : ["push", 0]; |
| 124 | this.images[method](img); |
| 125 | await this.update(shift); |
| 126 | } |
| 127 | } |
| 128 | |
| 129 | export const lightbox = new Lightbox(); |
no test coverage detected