Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | 32x 32x 32x 31x 3x 2x | import { Injectable } from '@angular/core';
import { Observable, Subject } from 'rxjs';
interface PaypalOrderData {
orderId: string;
paymentInstrumentId: string;
}
/**
* Service to communicate PayPal order data between NgRx effects and PayPal components
* without triggering Angular change detection.
*/
@Injectable({ providedIn: 'root' })
export class PaypalDataTransferService {
// Subject that emits PayPal order data when available.
private paypalOrderData$ = new Subject<PaypalOrderData>();
get paypalOrder$(): Observable<PaypalOrderData> {
return this.paypalOrderData$.asObservable();
}
// Emits PayPal order data to all subscribers.
emitPaypalOrderData(data: PaypalOrderData): void {
this.paypalOrderData$.next(data);
}
}
|