Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 

28 wiersze
558 B

  1. define([
  2. 'js/system/globals'
  3. ], function (
  4. globals
  5. ) {
  6. return {
  7. sprites: {},
  8. init: async function () {
  9. const { sprites } = this;
  10. const { clientConfig: { resourceList, textureList } } = globals;
  11. const fullList = [].concat(resourceList, textureList);
  12. return Promise.all(fullList.map(s => {
  13. return new Promise(res => {
  14. const spriteSource = s.includes('.png') ? s : `images/${s}.png`;
  15. const sprite = new Image();
  16. sprites[s] = sprite;
  17. sprite.onload = res;
  18. sprite.src = spriteSource;
  19. });
  20. }));
  21. }
  22. };
  23. });