Skylight Docs
Search
K

Binding to list of users

Showing a list of users in Skylight
BindingUsersRecipe.zip
3KB
Binary
Binding Users Recipe Application Bundle

What does this recipe include?

This recipe includes two views that are accessible from the root view:
  • The allUsers view has one card that is bound to skylight.local and an adapter that returns the value of await skylight.getUsers(). The card's text displays the user's username .
  • The filteredUsers view has one card that is bound to skylight.local and an adapter that filters the list of all users for users that have both the firstName and lastName properties, then maps each user to a new object that has a name property. The card's text displays this mapped object's name value.
skylight.local is an arbitrary context for these cards. In the adapter script, we ignore the context's value (which is stored in event.data) and work with await skylight.getUsers() instead.