File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change 2
2
3
3
## next
4
4
5
+ - Continue to initialize even if some images fail to load in inline mode.
5
6
- Avoid conflicts with nested modals (#540 ).
6
7
7
8
## 1.10.4 (Feb 13, 2022)
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import {
15
15
CLASS_INVISIBLE ,
16
16
DATA_ACTION ,
17
17
EVENT_CLICK ,
18
+ EVENT_ERROR ,
18
19
EVENT_LOAD ,
19
20
EVENT_READY ,
20
21
NAMESPACE ,
@@ -152,6 +153,7 @@ class Viewer {
152
153
forEach ( images , ( image ) => {
153
154
if ( ! image . complete ) {
154
155
removeListener ( image , EVENT_LOAD , progress ) ;
156
+ removeListener ( image , EVENT_ERROR , progress ) ;
155
157
}
156
158
} ) ;
157
159
} ,
@@ -161,7 +163,19 @@ class Viewer {
161
163
if ( image . complete ) {
162
164
progress ( ) ;
163
165
} else {
164
- addListener ( image , EVENT_LOAD , progress , {
166
+ let onLoad ;
167
+ let onError ;
168
+
169
+ addListener ( image , EVENT_LOAD , onLoad = ( ) => {
170
+ removeListener ( image , EVENT_ERROR , onError ) ;
171
+ progress ( ) ;
172
+ } , {
173
+ once : true ,
174
+ } ) ;
175
+ addListener ( image , EVENT_ERROR , onError = ( ) => {
176
+ removeListener ( image , EVENT_LOAD , onLoad ) ;
177
+ progress ( ) ;
178
+ } , {
165
179
once : true ,
166
180
} ) ;
167
181
}
You can’t perform that action at this time.
0 commit comments