Skip to content

stereobooster/react-ideal-image-experiments

Repository files navigation

react-ideal-image-experiments

Experiment to build async component according to Guide To Async Components

Eventually this will be extracted to react-ideal-image

Find a way to compose components

Ideas

  • In case of no JS situation we can show placeholder with links to full size images, instead download icon.
  • Use fetch to read http headers (content-length, status, date to detect if response is cached or not), without downloading the content itself.
  • Webworker maybe?
  • check contrast between placeholder and icon

Get screen resolutions

Usorted notes

var oReq = new XMLHttpRequest()

oReq.addEventListener('progress', updateProgress)
function updateProgress(oEvent) {
  if (oEvent.lengthComputable) {
    var percentComplete = oEvent.loaded / oEvent.total * 100
    // ...
  } else {
    // Unable to compute progress information since the total size is unknown
  }
}
window.addEventListener('orientationchange', function() {
  alert('the orientation of the device is now ' + screen.orientation.angle)
})
window.addEventListener('resize', resizeThrottler, false)
<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs=" />
.hourglass {
  animation: spin 5s cubic-bezier(0.8, 0, 0.2, 1) infinite;
}
@keyframes spin {
  90% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(180deg);
  }
}
<noscript>
  <style>.noscript{display:none}</style>
</noscript>