smartenv/ts/smartenv.classes.ts

22 lines
704 B
TypeScript
Raw Normal View History

2016-02-17 20:44:40 +00:00
/// <reference path="typings/main.d.ts" />
export class Environment {
public runtimeEnv:string;
public userAgent:string;
2015-12-01 07:29:58 +00:00
public nodeVersion:string;
public isBrowser:boolean;
public isNode:boolean;
constructor(runtimeEnvArg:string,userAgentArg:string = "undefined") {
this.runtimeEnv = runtimeEnvArg;
this.userAgent = userAgentArg;
if(runtimeEnvArg == "node"){
this.isBrowser = false;
this.isNode = true;
this.nodeVersion = process.version;
} else if (runtimeEnvArg == "browser") {
this.isBrowser = true;
this.isNode = false;
this.nodeVersion = "undefined";
}
};
2015-12-01 07:29:58 +00:00
}