Socket
Socket
Sign inDemoInstall

@vendasta/environment-service

Package Overview
Dependencies
6
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @vendasta/environment-service

Environment Service for frontend components to use.


Version published
Weekly downloads
1
decreased by-66.67%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

Environment Service

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

Requirements

The Environment Service interface:

export interface EnvironmentServiceInterface {
    getEnvironment(): Environment;
}

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

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)

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).

FAQs

Last updated on 21 Jun 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc