Class NotificationManager

public

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.

Show:

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;
}
token
UnsubscribeToken

remove a previous subscription