Installation
$ npm install fxos-fastlist
Usage
${title} ${body}
var list = document; // triggers renderlist;
Sections
To group list-items into sections, define a getSectionName()
function before assigning a model
.
list; list
Images
GaiaFastList takes care of rendering images for you to ensure that scrolling performance remains fast.
Place <div class="image"><img/></div>
as the first child of your list-item template.
${title} ${body}
Then define a .getItemImageSrc()
function that returns either a String
or a Blob
, sync or async (by returning a Promise
).
list;
Caching
The optional caching feature will cache rendered list-items and section HTML in localStorage
. On second render we inject the cached HTML right away for a really fast first-paint. This way the user see some content right away, giving you time to fetch your model behind the scenes.
...
list; // update the cached contentlist; // you can clear caches if need belist;
Optimizing reflows
Defining top
and bottom
offsets avoids the component having to read dimensions from the DOM, which can be costly. The following example is for a list that occupies the entire vertical screen space.
...
Offsetting content
Sometimes you may require elements other than list-items within your scrollable region (eg. a search field). The offset
attribute allows you to define a value which all list content will be offset by. The value should usually be the height of your 'foreign' element.
...
Developing locally
git clone https://github.com/fxos-components/fxos-fastlist.git
cd fxos-checkbox
npm install
(NPM3)npm start
Readiness
- Accessibility
- Localization
- Performance
- Visual/UX
- RTL
Tests
- Ensure Firefox Nightly is installed on your machine.
$ npm install
$ npm test
If your would like tests to run on file change use:
$ npm run test-dev
Lint check
Run lint check with command:
$ npm run lint