flexyford / impagination

A lazy data layer for your paged records
102 stars 7 forks source link

Implement Lazy interface #4

Closed cowboyd closed 8 years ago

cowboyd commented 8 years ago

Instead of:

for (var i = 0; i < state.records.length; i++) {
  console.log(state.records[i]);
}

we let you look up the record directly off of the state:

for (var i = 0; i < state.length; i++) {
  console.log(state.get(i));
}

That way we can be lazy about materializing the record array instead of doing it every time. state.records then goes away

flexyford commented 8 years ago

How do we handle getting the length of records ie state.records.length

We have state.totalSize which has never been implemented

cowboyd commented 8 years ago

put the length property right on state. This is the only eager calculation.

cowboyd commented 8 years ago

state.records will cease to exist.

cowboyd commented 8 years ago

Ticket description was updated to reflect using state.length instead of state.records.length

flexyford commented 8 years ago

@cowboyd can i get a review on #10 please