* Complete loading: invoke the callback and emit the LOADER_COMPLETE event. * @param {Function} onloadcb - the completion callback * @ignore
(onloadcb)
| 240 | * @ignore |
| 241 | */ |
| 242 | function completeLoading(onloadcb) { |
| 243 | const callback = onloadcb || onload; |
| 244 | if (typeof callback === "function") { |
| 245 | callback(); |
| 246 | } |
| 247 | // always signal completion — with the Promise form of preload() a callback |
| 248 | // is optional (you can `await` instead), so a missing callback is no longer |
| 249 | // an error; the loading screen / consumers react to LOADER_COMPLETE. |
| 250 | emit(LOADER_COMPLETE); |
| 251 | } |
| 252 | |
| 253 | /** |
| 254 | * just increment the number of already loaded resources |