os-js / osjs-gui

OS.js GUI Module
https://manual.os-js.org/v3/
Other
18 stars 10 forks source link

An event for reach bottom of listview #38

Closed miladhashemi closed 3 years ago

miladhashemi commented 3 years ago

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

andersevenrud commented 3 years ago

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
mahsashadi commented 3 years ago

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?

andersevenrud commented 3 years ago

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.

mahsashadi commented 3 years ago

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, ....?

andersevenrud commented 3 years ago

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
    })
  })
}
mahsashadi commented 3 years ago

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.

andersevenrud commented 3 years ago

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).

andersevenrud commented 3 years ago

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