# @vendasta/environment-service

> Environment Service for frontend components to use.

Latest version **1.0.2** (published 2017-06-21) · ISC license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @vendasta/environment-service
pnpm add @vendasta/environment-service
yarn add @vendasta/environment-service
bun add @vendasta/environment-service
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2017-06-21 |
| First published | 2017-06-08 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 (+8 in 1 direct dependencies) |
| Install scripts | no |
| Author | Vendasta R&D |
| Maintainers | vendasta |

## Links

- npm: https://www.npmjs.com/package/@vendasta/environment-service
- npm.io page: https://npm.io/package/@vendasta/environment-service

## Dependencies (4)

- [rxjs](https://npm.io/package/rxjs.md) ^5.0.0
- [core-js](https://npm.io/package/core-js.md) ^2.0.0
- [zone.js](https://npm.io/package/zone.js.md) ^0.8.0
- [@angular/core](https://npm.io/package/@angular/core.md) ^4.0.0

## Recent versions

- 1.0.2 (latest) — 2017-06-21
- 1.0.1 — 2017-06-14
- 1.0.0 — 2017-06-08

## README

# Environment Service

This provides a service for other components to use to retrieve environment information.

## Requirements

The Environment Service interface:

```typescript
export interface EnvironmentServiceInterface {
    getEnvironment(): Environment;
}
```

To implement the interface make a new service that implements the interface:

```typescript
…
import {EnvironmentServiceInterface, Environment} from '@vendasta/environment-service';

@Injectable()
export class EnvironmentService implements EnvironmentServiceInterface {
  …
  getEnvironment(): Environment {
    // Implement how the project determine which environment to run in.
  }
}
```

Next you will need to provide your service as that interface (generally in `app.module.ts`)

```typescript
import { EnvironmentService } from './environment.service';
import { EnvironmentServiceInterfaceToken } from '@vendasta/environment-service';
…
@NgModule({
  …
  providers: [
    EnvironmentService, {provide: EnvironmentServiceInterfaceToken, useExisting: EnvironmentService}
  ],
})
```

* Note: To be able to inject an interface, you will have to provide the InjectionToken and not the interface itself (`EnvironmentServiceInterfaceToken` vs `EnvironmentServiceInterface`).

---
_Source: https://npm.io/package/@vendasta/environment-service · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
