Class NotificationManager
public
Module:
@ember-data/store
The NotificationManager provides the ability to subscribe to changes to Cache state.
This Feature is what allows EmberData to create subscriptions that work with any framework or change-notification system.
subscribe (identifier, callback) UnsubscribeToken public
Module:
@ember-data/store
Defined in ../packages/store/src/-private/managers/notification-manager.ts:101
- identifier
- StableDocumentIdentifier | StableRecordIdentifier | 'resource' | 'document'
- callback
- NotificationCallback | ResourceOperationCallback | DocumentOperationCallback
- returns
- UnsubscribeToken
an opaque token to be used with unsubscribe
Subscribe to changes for a given resource identifier, resource addition/removal, or document addition/removal.
export type CacheOperation = 'added' | 'removed' | 'updated' | 'state';
export interface NotificationCallback {
(identifier: StableRecordIdentifier, notificationType: 'attributes' | 'relationships', key?: string): void;
(identifier: StableRecordIdentifier, notificationType: 'errors' | 'meta' | 'identity' | 'state'): void;
(identifier: StableRecordIdentifier, notificationType: NotificationType, key?: string): void;
}
export interface ResourceOperationCallback {
// resource updates
(identifier: StableRecordIdentifier, notificationType: CacheOperation): void;
}
export interface DocumentOperationCallback {
// document updates
(identifier: StableDocumentIdentifier, notificationType: CacheOperation): void;
}
unsubscribe (token) public
Module:
@ember-data/store
Defined in ../packages/store/src/-private/managers/notification-manager.ts:155
- token
- UnsubscribeToken
remove a previous subscription