smartenv/dist/smartenv.environment.js

35 lines
2.5 KiB
JavaScript
Raw Normal View History

2016-04-04 16:24:22 +00:00
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
2016-11-21 10:58:37 +00:00
const classes = require("./smartenv.classes");
const objectStorage = require("./smartenv.objectstorage");
let environment;
let envDetermined = false;
2016-02-17 20:44:40 +00:00
/**
* returns the environment
* @returns {Environment}
*/
2016-02-20 09:50:32 +00:00
exports.getEnv = function () {
2016-02-17 20:44:40 +00:00
if (!envDetermined) {
2016-02-20 09:11:25 +00:00
environment = new classes.Environment();
2016-02-17 20:44:40 +00:00
envDetermined = true; // ensure code above only runs once
}
;
return environment;
};
/**
* prints the environment to console
*/
2016-02-20 09:50:32 +00:00
exports.printEnv = function () {
2016-02-17 20:44:40 +00:00
if (this.getEnv().isNode) {
2016-11-21 10:58:37 +00:00
console.log('running on NODE');
let smartenvVersion = require('../package.json').version;
console.log('node version is ' + this.getEnv().nodeVersion + ' and smartenv version is ' + smartenvVersion);
2016-02-17 20:44:40 +00:00
}
else {
2016-11-21 10:58:37 +00:00
console.log('running on BROWSER');
console.log('browser is ' + this.getEnv().userAgent);
2016-02-17 20:44:40 +00:00
}
2016-11-21 10:58:37 +00:00
console.log('the smartenv registration store currently holds the following properties:');
2016-02-18 12:27:45 +00:00
console.log(Object.getOwnPropertyNames(objectStorage.obs.getAll()));
2016-02-17 20:44:40 +00:00
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRlbnYuZW52aXJvbm1lbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydGVudi5lbnZpcm9ubWVudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUlBLDhDQUE2QztBQUM3QywwREFBeUQ7QUFHekQsSUFBSSxXQUFnQyxDQUFBO0FBQ3BDLElBQUksYUFBYSxHQUFZLEtBQUssQ0FBQTtBQUVsQzs7O0dBR0c7QUFD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