Frameworks
Angular
An injectable service, initialised once the browser is running.
pnpm add @thepulseapi/sdkimport { Injectable } from '@angular/core';
import { PulseClient } from '@thepulseapi/sdk';
@Injectable({ providedIn: 'root' })
export class PulseService extends PulseClient {}Initialise from APP_INITIALIZER, or from the first component that runs in the browser:
import { APP_INITIALIZER } from '@angular/core';
import { PulseService } from './pulse.service';
export const appConfig = {
providers: [
{
provide: APP_INITIALIZER,
multi: true,
deps: [PulseService],
useFactory: (pulse: PulseService) => () =>
pulse.init({ apiKey: 'pk_live_...', organizationId: 'org_...' }),
},
],
};
