code: function compareImageLoadPriority(a, b) {
          var aon = false;
          var bon = false;
  
          // Currently isOnScreen is synchronous and fast for list view
          a.isOnScreen().then(function (v) { aon = v; });
          b.isOnScreen().then(function (v) { bon = v; });
  
          return (aon ? 0 : 1) - (bon ? 0 : 1);
      }
docs: This optimization is good for a couple of reasons: - It is a global optimizer, which means that all on screen images take precedence over all off screen images. - It avoids resorting too frequently by only resorting when a new image loads and it has been at least 64 ms since the last sort. Also, it is worth noting that "sort" on an empty queue does no work (besides the function call).