fxos-components / fxos-fastlist

https://fxos-components.github.io/fxos-fastlist/examples
3 stars 3 forks source link

Add .getImage() hook #7

Closed wilsonpage closed 9 years ago

wilsonpage commented 9 years ago

When the .populateItemDetail() hook lands in fast-list.js we can expose a higher level API to allow users of gaia-fast-list to provide an image for their list-item.

lit.configure({
  getItemImage(i) {
     return getImageSrcForItem(i);
  }
});

Open questions:

  1. Will .populateItemDetail() support returning a Promise? I think this may be a requirement for Music. Unless we just run it and make a check that the item position hasn't changed when we get the image back.
  2. How should we get a handle on the user provided <img>? We could possibly just .querySelector('img') once when the item is created and store the referece somewhere convenient. So long as we're not running .querySelector() every time we .render(), things should be good.
wilsonpage commented 9 years ago

@etiennesegonzac ?