Skip to content

Commit

Permalink
add unsubscribe token
Browse files Browse the repository at this point in the history
  • Loading branch information
igorT committed May 22, 2019
1 parent 6c63fd8 commit 959be70
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions text/0000-custom-model-classes.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,16 @@ subscribe and unsubscribe to notifications of underlying changes to the data. On
any registered callback for the given identifier, and pass in the type of the notification, allowing the record the opportunity to repull the data if needed. There are no guarantees around the timing of the notification callback being called after `RecordData` informs the store of changes. We expect that in a modern Ember app with tracked properties, this wouldn't be the common path for tracking changes.

```ts
interface UnsubscribeToken {
unsubscribe(): void;
}

interface NotificationCallback {
(identifier: Identifier, notificationType: 'attributes' | 'relationships' | 'errors' | 'meta' | 'unload'): void;
}

interface NotificationManager {
subscribe(identifier, NotificationCallback): void
unsubscribe(identifier, NotificationCallback): void
subscribe(identifier, NotificationCallback): UnsubscribeToken
}
```

Expand Down

0 comments on commit 959be70

Please sign in to comment.