Files
oidc-client-rx/src/utils/platform-provider/platform.provider.ts
2025-01-31 05:57:51 +08:00

15 lines
372 B
TypeScript

import { Injectable, InjectionToken, inject } from 'injection-js';
export type PlatformId = 'browser' | 'server';
export const PLATFORM_ID = new InjectionToken<PlatformId>('PLATFORM_ID');
@Injectable()
export class PlatformProvider {
private readonly platformId = inject<string>(PLATFORM_ID);
isBrowser(): boolean {
return this.platformId === 'browser';
}
}