smartenv/ts/smartenv.environment.ts
2015-11-30 19:58:35 +01:00

25 lines
748 B
TypeScript

/// <reference path="index.ts" />
/**
* Deals with the environment the current JS script is running in.
*/
module SmartenvEnvironment {
export function init(){
var environment:Environment;
(function() {
var localRunTimeEnv = "undefined";
var localUserAgent = "undefined";
if (typeof window !== 'undefined') {
localRunTimeEnv = 'browser';
localUserAgent = navigator.userAgent;
} else if (typeof process !== 'undefined') {
localRunTimeEnv = 'node';
}
environment = new Environment(localRunTimeEnv,localUserAgent);
})();
return function() {
return environment;
};
}
}