vhmth / helix Goto Github PK
View Code? Open in Web Editor NEWAn efficient infinite scroll implementation.
An efficient infinite scroll implementation.
Add a bower file and publish via bower. Probably a much later task after the library is ready for widespread use.
Handle either AMD, CJS or window global export based on how someone builds. Building should result in three files:
dist/global/helix.js
dist/amd/helix.js
dist/cjs/helix.js
A catch-all export could be a nice alternative well (code in coffeescript):
if typeof module is 'object' and typeof module.exports is 'object'
module.exports = Helix
else if typeof define is 'function' and define.amd?
define('helix', [], -> return Helix)
else
window.Helix = Helix
If requestModels
supplies an array of models shorter than the range requested, the Helix instance could do one or more of these things:
Assume it has reached the end of the scroll range and will not request models past the last model index supplied.
Remove all cache entries for elements past the last index supplied if an internal height cache is being maintained.
Subtract height from the bottom or top "stub" element as necessary.
This is an edge case we can deal with later.
Will probably use the Google Closure implementation unless anyone has other suggestions. Would like to do this after we have test suites and a test for the height cache module itself to make sure we're actually getting a perf increase.
We should allow for the option of a view to be inserted at the top/bottom of the viewport when we're waiting on all models to finish being fetched.
Test suite for internal module functionality. Probably with something like mocha and grunt.
cvuong we agreed there would be prefetch options. I was thinking there could be granularity over how many items to prefetch below and after the viewport, but it may make more sense to just have one option and assume it applies in both directions. So:
prefetch: NUM_ITEMS_TO_PREFETCH // defaults to 10
An example logic model (from initialization):
Request prefetch models.
Request element for each of the models supplied.
Fill the viewport with element.
We do steps 2 & 3 until the viewport is full or the models are used. If the models are all used, we start at step 1 again. If not:
Add leftover models to bottom prefetch cache (if there are any left).
Request models until prefetch caches are full (top and bottom cache).
If there was a height cache being maintained and setElementHeight is called, we should destroy the cache. If all heights were assumed to be static and setElementHeightAtIndex is called, degrade to calculating heights on the fly.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.