os-js / osjs-gui

OS.js GUI Module

Home Page:https://manual.os-js.org/v3/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

An event for reach bottom of listview

miladhashemi opened this issue · comments

It's better to have an event when we reach to end of the list.

I've added the action scroll to the listview where you get an event as the argument. You can use ev.target to calculate any point, not just the bottom.

const el = ev.target
const hitBottom = (el.scrollTop + el.innerHeight) >= el.scrollHeight

Hi.

We are considering extending the FileManager Application, to support gradual fetching of data by scrolling down.

The VFS adapter should support readdir with limitation. For example in readdir function of our server-side VFS adapter we should consider two limit (number of returned items) and marker (the last item previously returned) parameters.

Since some Adapters may support this feature and some not, what is the best suggestion to add this feature in FileManager Application?

The best solution for this is to create an interface in the VFS that can be used in options so that all adapters that supports this feature will use the same arguments when using the API.

By interface in the VFS, you mean we should develop another VFS service-provider that expose readdirLimited method, in addition to other methods like readdir, readfile, ....?

I mean into the VFS API:

// usage
vfs.readdir('mount:/path', {
  // new interface
  page: {
    size: Number,
    token: String
  }
})

// adapter
function readdir(path, options) {
  fetch('http://localhost', {
    body: JSON.stringify({
      limit: options.page.size,
      marker: options.page.token
    })
  })
}

Is this client-side options accessibile in server-side VFS adapter?

Whatever I add in options client-side in file-manager, server-side VFS adapter options only contains session object.

All options are passed along to the server-side adapter. But it actually looks like the readdir in the default system adapter explicitly sets options to {} (which is not right).

Also, this is off-topic now. Start a new issue please :)