mirror of
https://github.com/HeyPuter/puter.git
synced 2026-10-11 06:11:56 +00:00
docs: notification examples use notif:app-user, which apps can read
This commit is contained in:
1 parent
e2f608aa5f
commit
95a5a85c95
4 files changed
+9
-9
No files matched your search
@@ -20,7 +20,7 @@ What you watch is written as a subject string:
|
||||
| `fs:~/Documents` | Everything under a folder, or one file by path or uid |
|
||||
| `fs:~/inbox/*.json:add` | Matching paths, one kind of change |
|
||||
| `kv:cart` | One key in your app's key-value store (`kv:cart*` for a prefix) |
|
||||
| `notif:account` | The user's notifications |
|
||||
| `notif:app-user` | Notifications about the user's use of your app |
|
||||
|
||||
See [`onLocal()`](/Events/onLocal/#subjects) for the full subject syntax, the event shape, and how to share key-value events with another user.
|
||||
|
||||
@@ -239,7 +239,7 @@ With the [User-Pays Model](/user-pays-model/), deliveries are billed to the user
|
||||
let seen = 0;
|
||||
do {
|
||||
const page = await puter.events.fetch({
|
||||
subject: 'notif:account',
|
||||
subject: 'notif:app-user',
|
||||
after,
|
||||
});
|
||||
for (const event of page.items) {
|
||||
|
||||
@@ -21,7 +21,7 @@ puter.events.fetch(options)
|
||||
|
||||
#### `options` (Object) (required)
|
||||
|
||||
- `subject` (String) (required): What to read: `notif:account` (the account's notifications), `notif:app-user` (the ones belonging to the app you're running as), or `notif:<appId>:<audience>`. Audiences are `account`, `developer` (about an app, sent to its owner), and `app-user` (about your data inside an app).
|
||||
- `subject` (String) (required): What to read: `notif:app-user` (the ones belonging to the app you're running as), `notif:developer` (about your app, for its owner), or `notif:<appId>:<audience>`. Audiences are `account`, `developer` (about an app, sent to its owner), and `app-user` (about your data inside an app). Apps and websites never see `account` notifications: `notif:account` returns an empty page for them.
|
||||
- `after` (String): The `cursor` from the previous page. Leave it off to start from the oldest notification still kept.
|
||||
- `limit` (Number): Events per page. Defaults to 50, max 200.
|
||||
|
||||
@@ -68,7 +68,7 @@ The promise rejects with `{ message, code }`: `fetch_unsupported_subject` for `f
|
||||
let seen = 0;
|
||||
do {
|
||||
const page = await puter.events.fetch({
|
||||
subject: 'notif:account',
|
||||
subject: 'notif:app-user',
|
||||
after,
|
||||
});
|
||||
for (const event of page.items) {
|
||||
@@ -103,10 +103,10 @@ The promise rejects with `{ message, code }`: `fetch_unsupported_subject` for `f
|
||||
|
||||
// Live first, so nothing arriving during the catch-up is lost —
|
||||
// `id` is what makes the overlap harmless.
|
||||
const sub = await puter.events.onLocal('notif:account',
|
||||
const sub = await puter.events.onLocal('notif:app-user',
|
||||
({ event }) => show(event));
|
||||
|
||||
const page = await puter.events.fetch({ subject: 'notif:account' });
|
||||
const page = await puter.events.fetch({ subject: 'notif:app-user' });
|
||||
page.items.forEach(show);
|
||||
|
||||
await sub.off();
|
||||
|
||||
@@ -13,10 +13,10 @@
|
||||
|
||||
// Live first, so nothing arriving during the catch-up is lost —
|
||||
// `id` is what makes the overlap harmless.
|
||||
const sub = await puter.events.onLocal('notif:account',
|
||||
const sub = await puter.events.onLocal('notif:app-user',
|
||||
({ event }) => show(event));
|
||||
|
||||
const page = await puter.events.fetch({ subject: 'notif:account' });
|
||||
const page = await puter.events.fetch({ subject: 'notif:app-user' });
|
||||
page.items.forEach(show);
|
||||
|
||||
await sub.off();
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
let seen = 0;
|
||||
do {
|
||||
const page = await puter.events.fetch({
|
||||
subject: 'notif:account',
|
||||
subject: 'notif:app-user',
|
||||
after,
|
||||
});
|
||||
for (const event of page.items) {
|
||||
|
||||
Reference in new issue
Block a user