en.javascript.info/2-ui/3-event-details/11-onload-onerror/1-load-img-callback/solution.md
Ilya Kantor 1f61c2ab1d ok
2017-03-15 00:43:43 +03:00

6 lines
240 B
Markdown

The algorithm:
1. Make `img` for every source.
2. Add `onload/onerror` for every image.
3. Increase the counter when either `onload` or `onerror` triggers.
4. When the counter value equals to the sources count -- we're done: `callback()`.