Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop data-resources API for widgets #1046

Closed
tomdye opened this issue Jan 24, 2020 · 1 comment
Closed

Develop data-resources API for widgets #1046

tomdye opened this issue Jan 24, 2020 · 1 comment
Assignees

Comments

@tomdye
Copy link
Member

tomdye commented Jan 24, 2020

Enhancement

As part of the work on paginated virtual scrolling we discovered the need for a consistent data-aware widget pattern. This would take the form of a resource middleware that exposes an API to the widget to get the data it requires.

The resource handling side of things will be handled by framework for dojo 7. This issue is related to the widget API side of things.

Initial POC for this using a basic menu / typeahead can be seen here in code sandbox.

This works by creating a resource which is then passed down from the typeahead to it's menu. the resource itself is reactive and will work similar to icache by invalidating the widget when data becomes available.
Thus far the API exposed by the resources middleware is:

interface ResourceMiddleware {
  getOrRead: ({ offset, query, pageSize }: GetOrReadProps) => any;
  setQuery: (newQuery?: string) => void;
  setOffset: (newOffset: number) => void;
  setPageSize: (newPageSize: number) => void;
  gotoPage: (pageNumber: any) => void;
  next: () => void;
  previous: () => void;
  current: () => GetOrReadProps;
}
@tomdye
Copy link
Member Author

tomdye commented Mar 20, 2020

This was completed via dojo/framework#672

@tomdye tomdye closed this as completed Mar 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant