2015-11-30 14:04:04 +00:00
|
|
|
/// <reference path="index.ts" />
|
|
|
|
class Environment {
|
|
|
|
public runtimeEnv:string;
|
|
|
|
public userAgent:string;
|
2015-12-01 07:29:58 +00:00
|
|
|
public nodeVersion:string;
|
2015-11-30 14:04:04 +00:00
|
|
|
public isBrowser:boolean;
|
|
|
|
public isNode:boolean;
|
2015-12-24 23:22:28 +00:00
|
|
|
constructor(runtimeEnvArg:string,userAgentArg:string = "undefined") {
|
2015-11-30 14:04:04 +00:00
|
|
|
this.runtimeEnv = runtimeEnvArg;
|
|
|
|
this.userAgent = userAgentArg;
|
|
|
|
if(runtimeEnvArg == "node"){
|
|
|
|
this.isBrowser = false;
|
|
|
|
this.isNode = true;
|
|
|
|
this.nodeVersion = process.version;
|
2015-12-24 23:22:28 +00:00
|
|
|
} else if (runtimeEnvArg == "browser") {
|
2015-11-30 14:04:04 +00:00
|
|
|
this.isBrowser = true;
|
2015-12-24 23:22:28 +00:00
|
|
|
this.isNode = false;
|
2015-11-30 14:04:04 +00:00
|
|
|
this.nodeVersion = "undefined";
|
|
|
|
}
|
|
|
|
};
|
2015-12-01 07:29:58 +00:00
|
|
|
}
|