Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

capacitor-detect-environment

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

capacitor-detect-environment

Detect Environment plugin for capacitor

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Capacitor detect environment plugin .github/workflows/github-actions.yml

Plugin for determining the current environment

Currently only works on ios, but android support will be coming soon

Available methods:

  • isDebug()
  • isTestFlight()
  • isAdHoc()
  • isSimulator()
  • isAppStore()
  • isSandbox()

Usage example:

  1. In your module (e.g. app.module.ts)
...
import { DetectEnvironment } from 'capacitor-detect-environment'

@NgModule({
	...
	providers: [
		...
		DetectEnvironment,
	],
})
export class AppModule {}

  1. In your component or service (e.g. api.service.ts)
...
import { DetectEnvironment } from 'capacitor-detect-environment'

@Injectable()
export class ApiService {
	constructor(private env: DetectEnvironment) {}

    async getApiHost() {
        const isDebug = await this.env.isDebug()
        if (isDebug) return 'https://dev.api.com'
        else return 'https://api.com'
    }
}

BREAKING CHANGES in 1.x.x version

  • Added full support for Capacitor 3 and removed compatibility with Capacitor 2

Keywords

FAQs

Package last updated on 02 Mar 2024

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc