Skip to content

Commit

Permalink
added logs to make sure preloader respects numberOfConcurrentPreloads…
Browse files Browse the repository at this point in the history
… option
  • Loading branch information
kfiroo committed Aug 5, 2017
1 parent 096d479 commit 9b7c34d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CachedImageExample/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,8 @@ class CachedImageExample extends React.Component {
<ImageCacheProvider
urlsToPreload={images}
onPreloadComplete={() => ReactNative.Alert.alert('onPreloadComplete')}
ttl={60}>
ttl={60}
numberOfConcurrentPreloads={0}>
<ListView
dataSource={this.state.dataSource}
renderRow={this.renderRow}
Expand Down
4 changes: 4 additions & 0 deletions ImageCachePreloader.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,13 @@ function runPreloadTask(prefetcher, imageCacheManager) {
if (!url) {
return Promise.resolve();
}
// console.log('START', url);
return imageCacheManager.downloadAndCacheUrl(url)
// allow prefetch task to fail without terminating other prefetch tasks
.catch(_.noop)
// .then(() => {
// console.log('END', url);
// })
// then run next task
.then(() => runPreloadTask(prefetcher, imageCacheManager));
}
Expand Down

0 comments on commit 9b7c34d

Please sign in to comment.