MCPcopy Create free account
hub / github.com/microsoft/SandDance / loadImages

Function loadImages

docs/tests/v2/es6/js/sanddance.js:35922–35943  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

35920
35921
35922function loadImages() {
35923 var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
35924 var urls = opts.urls,
35925 _opts$onProgress2 = opts.onProgress,
35926 onProgress = _opts$onProgress2 === void 0 ? noop : _opts$onProgress2;
35927 (0, _assert.default)(urls.every(function (url) {
35928 return typeof url === 'string';
35929 }), 'loadImages: {urls} must be array of strings');
35930 var count = 0;
35931 return Promise.all(urls.map(function (url) {
35932 var promise = (0, _browserLoad.loadImage)(url, opts);
35933 promise.then(function (file) {
35934 return onProgress({
35935 progress: ++count / urls.length,
35936 count: count,
35937 total: urls.length,
35938 url: url
35939 });
35940 });
35941 return promise;
35942 }));
35943}
35944
35945function loadTextures(gl) {
35946 var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

Callers 1

loadTexturesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected