tinylib.friends
Your app sees the user's friends who use it. It can't add or remove friends; people do that in Tinylib.
Reading friends or their values needs "friends" in your app's uses.
Lists the user's friends who use your app, leaving out anyone blocked either way.
JavaScript
const friends = await tinylib.friends.list()
tinylib.friends.sendApp(): Promise<void>
Opens Tinylib's send sheet, where the user picks any of their friends to send your app to. Resolves when the sheet closes, without saying who was picked.
Rejects with
- refused
- When the user is a guest.
- offline
interface FriendsData
Reads the values the user's friends saved with
audience: 'friends'. Nothing tells your client when they change, so read them each time you show them.Methods
- get(key)
- Reads every friend's value under
key. - of(friendId)
- Returns a read-only store of the values one friend saved with
audience: 'friends'.
Reads every friend's value under
key.JavaScript
const best = await tinylib.friends.data.get('best')
Parameters
- keystring
- The key to read.
Returns
- Promise<Map<string, FriendValue>>
- A
Mapfrom each friend's id to theirFriendValue. Friends with no value underkeyare left out.
Rejects with
- refused
- When your app's
useslacks"friends", or the user is a guest. - offline
Returns a read-only store of the values one friend saved with
audience: 'friends'. The store is empty for anyone who isn't the user's friend.JavaScript
const days = await tinylib.friends.data.of(friend.id).entries('day/')
// [['day/2026-10-20', { value: 280, changedAt: 1792540800000 }], …]
Parameters
- friendIdstring
- The friend's id, from
tinylib.friends.list.
Returns
- RemoteStore<FriendValue>
- A
RemoteStoreof the friend's values, each aFriendValue. Its methods reject withrefusedwhen your app'suseslacks"friends"or the user is a guest, and withofflinewithout a connection.
interface FriendValue
A value a friend saved with
audience: 'friends', and when it last changed.Properties
- valueunknown
- The value, as the friend saved it.
- changedAtnumber
- When the value last changed, in milliseconds on Tinylib's clock.
interface RemoteStore<V>
A read-only store with the read methods of
tinylib.data, reading from Tinylib's servers. The call that returned the store lists what its methods reject with.Methods
- get(key)
- Resolves with the value under
key, orundefinedwhen there's none. - keys(prefix?)
- Resolves with the keys that start with
prefix, or every key without it, sorted. - values(prefix?)
- Resolves with the values under the keys that start with
prefix, or every value without it, sorted by key. - entries(prefix?)
- Resolves with the
[key, value]pairs whose keys start withprefix, or every pair without it, sorted by key.
RemoteStore.get(key: string): Promise<V | undefined>
Resolves with the value under
key, or undefined when there's none.RemoteStore.keys(prefix?: string): Promise<string[]>
Resolves with the keys that start with
prefix, or every key without it, sorted.RemoteStore.values(prefix?: string): Promise<V[]>
Resolves with the values under the keys that start with
prefix, or every value without it, sorted by key.RemoteStore.entries(prefix?: string): Promise<[string, V][]>
Resolves with the
[key, value] pairs whose keys start with prefix, or every pair without it, sorted by key.