From 4d5e69da7d9fe15bb55b2f48e99891f5b8db3f87 Mon Sep 17 00:00:00 2001 From: Juan Tejada Date: Fri, 17 Feb 2017 12:30:37 -0800 Subject: [PATCH] [*] metrics(Part 1) Add env-helpers to iso core Summary: This is a set of functions which will allow isomorphic-core to detect which environment it is running on. This will be useful for moving the metrics reporter to iso-core Test Plan: manual Reviewers: mark, spang Reviewed By: spang Differential Revision: https://phab.nylas.com/D3966 --- packages/isomorphic-core/src/env-helpers.es6 | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 packages/isomorphic-core/src/env-helpers.es6 diff --git a/packages/isomorphic-core/src/env-helpers.es6 b/packages/isomorphic-core/src/env-helpers.es6 new file mode 100644 index 000000000..c63359103 --- /dev/null +++ b/packages/isomorphic-core/src/env-helpers.es6 @@ -0,0 +1,8 @@ + +export function isClientEnv() { + return typeof window !== 'undefined' && typeof window.NylasEnv !== 'undefined' +} + +export function isCloudEnv() { + return !isClientEnv() +}