Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
582afc0361 | |||
c054ecb0c7 | |||
249b626bb5 | |||
08d743477f | |||
fb64e8004d | |||
f5e48e4fd3 | |||
d2de8231cc | |||
0f784e2d74 | |||
f994c34bc7 | |||
503f030089 |
9
.gitignore
vendored
9
.gitignore
vendored
@ -1,3 +1,10 @@
|
||||
node_modules/
|
||||
.settings/
|
||||
.idea/
|
||||
.idea/
|
||||
|
||||
|
||||
#npm devug
|
||||
npm-debug.log
|
||||
|
||||
ts/*.js
|
||||
ts/*.js.map
|
||||
|
116
index.js
116
index.js
@ -1,28 +1,100 @@
|
||||
/// <reference path="index.ts" />
|
||||
var Environment = (function () {
|
||||
function Environment(runtimeEnvArg, userAgentArg) {
|
||||
if (userAgentArg === void 0) { userAgentArg = "undefined"; }
|
||||
this.runtimeEnv = runtimeEnvArg;
|
||||
this.userAgent = userAgentArg;
|
||||
if (runtimeEnvArg == "node") {
|
||||
this.isBrowser = false;
|
||||
this.isNode = true;
|
||||
this.nodeVersion = process.version;
|
||||
}
|
||||
else {
|
||||
this.isBrowser = true;
|
||||
this.isNode = true;
|
||||
this.nodeVersion = "undefined";
|
||||
}
|
||||
}
|
||||
;
|
||||
return Environment;
|
||||
})();
|
||||
/// <reference path="index.ts" />
|
||||
/**
|
||||
* Deals with the environment the current JS script is running in.
|
||||
*/
|
||||
var SmartenvEnvironment;
|
||||
(function (SmartenvEnvironment) {
|
||||
function init() {
|
||||
var 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;
|
||||
};
|
||||
}
|
||||
SmartenvEnvironment.init = init;
|
||||
})(SmartenvEnvironment || (SmartenvEnvironment = {}));
|
||||
/// <reference path="index.ts" />
|
||||
var SmartenvObjectStorage;
|
||||
(function (SmartenvObjectStorage) {
|
||||
function init() {
|
||||
var obs = {};
|
||||
var obsItems = {};
|
||||
obs.addItem = function (objectArg, paramName) {
|
||||
if (paramName === void 0) { paramName = "undefined"; }
|
||||
if (paramName == "undefined") {
|
||||
plugins.beautylog.error("paramName is undefined");
|
||||
return;
|
||||
}
|
||||
obsItems[paramName] = objectArg;
|
||||
};
|
||||
obs.getItem = function (keyName) {
|
||||
return obsItems[keyName];
|
||||
};
|
||||
obs.getComplete = function () {
|
||||
return obsItems;
|
||||
};
|
||||
obs.addComplete = function (itemsArg) {
|
||||
obsItems = plugins._.assign(obsItems, itemsArg);
|
||||
return obsItems;
|
||||
};
|
||||
return obs;
|
||||
}
|
||||
SmartenvObjectStorage.init = init;
|
||||
})(SmartenvObjectStorage || (SmartenvObjectStorage = {}));
|
||||
/// <reference path="typings/tsd.d.ts" />
|
||||
var beautylog = require("beautylog")("os");
|
||||
var addToGlobal = function (objectArg, paramName) {
|
||||
global[paramName] = objectArg;
|
||||
/// <reference path="smartenv.classes.ts" />
|
||||
/// <reference path="smartenv.environment.ts" />
|
||||
/// <reference path="smartenv.objectstorage.ts" />
|
||||
var plugins = {
|
||||
beautylog: require("beautylog")("os"),
|
||||
_: require("lodash")
|
||||
};
|
||||
var smartenv = {}; //create smartenv object
|
||||
smartenv.items = {}; // create the items object to store items to.
|
||||
smartenv.makeGlobal = function () {
|
||||
addToGlobal(smartenv, "smartenv"); //add object smartenv as global["smartenv"]
|
||||
};
|
||||
smartenv.info = function () {
|
||||
var pck = require("./package.json");
|
||||
beautylog.log("node version is " + process.version + " and smartenv version is " + pck.version);
|
||||
beautylog.log("the smartenv module currently holds the following properties:");
|
||||
console.log(Object.getOwnPropertyNames(smartenv.items).sort());
|
||||
};
|
||||
smartenv.register = function (objectArg, paramName) {
|
||||
if (paramName === void 0) { paramName = "undefined"; }
|
||||
if (paramName == "undefined") {
|
||||
beautylog.error("paramName is undefined");
|
||||
return;
|
||||
smartenv.getEnv = SmartenvEnvironment.init();
|
||||
smartenv.obs = SmartenvObjectStorage.init();
|
||||
/* ----------------------------------------- *
|
||||
* ----- print info ------------------------ *
|
||||
* ----------------------------------------- */
|
||||
smartenv.printEnv = function () {
|
||||
if (smartenv.getEnv().isNode) {
|
||||
var smartenvVersion = require("./package.json").version;
|
||||
plugins.beautylog.log("node version is " + smartenv.getEnv().nodeVersion + " and smartenv version is " + smartenvVersion);
|
||||
}
|
||||
smartenv.items[paramName] = objectArg;
|
||||
};
|
||||
smartenv.get = function (keyName) {
|
||||
return smartenv.items[keyName];
|
||||
else {
|
||||
plugins.beautylog.log("browser is " + smartenv.getEnv().userAgent);
|
||||
}
|
||||
plugins.beautylog.log("the smartenv registration store currently holds the following properties:");
|
||||
console.log(Object.getOwnPropertyNames(smartenv.obs.getComplete).sort());
|
||||
};
|
||||
module.exports = smartenv;
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "smartenv",
|
||||
"version": "0.0.3",
|
||||
"version": "0.0.8",
|
||||
"description": "store things about your environment and let them travel across modules",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
@ -23,7 +23,8 @@
|
||||
},
|
||||
"homepage": "https://github.com/pushrocks/smartenv",
|
||||
"dependencies": {
|
||||
"beautylog": "^1.0.4"
|
||||
"beautylog": "^1.0.4",
|
||||
"lodash": "^3.10.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"gulp": "^3.9.0",
|
||||
|
15
test.js
15
test.js
@ -2,10 +2,13 @@
|
||||
var smartenv = require("./index.js");
|
||||
var beautylog = require("beautylog")("os");
|
||||
beautylog.info("Now testing the smartenv module");
|
||||
smartenv.info();
|
||||
smartenv.register({ key1: "Peter" }, "docit");
|
||||
smartenv.info();
|
||||
beautylog.log(smartenv.get("docit").key1);
|
||||
smartenv.makeGlobal();
|
||||
beautylog.log(global.smartenv.get("docit").key1);
|
||||
smartenv.printEnv();
|
||||
beautylog.info("Now testing the smartenv module");
|
||||
smartenv.obs.addItem({ key1: "Peter" }, "docit");
|
||||
smartenv.printEnv();
|
||||
beautylog.log(smartenv.obs.getItem("docit").key1);
|
||||
beautylog.log(smartenv.obs.getItem("docit").key1);
|
||||
var key2 = "hello";
|
||||
smartenv.obs.getItem("docit").key2 = key2;
|
||||
beautylog.log(smartenv.obs.getItem("docit").key2);
|
||||
beautylog.success("Success!");
|
||||
|
42
ts/index.js
42
ts/index.js
@ -1,29 +1,27 @@
|
||||
/// <reference path="typings/tsd.d.ts" />
|
||||
var beautylog = require("beautylog")("os");
|
||||
var addToGlobal = function (objectArg, paramName) {
|
||||
global[paramName] = objectArg;
|
||||
/// <reference path="smartenv.classes.ts" />
|
||||
/// <reference path="smartenv.environment.ts" />
|
||||
/// <reference path="smartenv.objectstorage.ts" />
|
||||
var plugins = {
|
||||
beautylog: require("beautylog")("os"),
|
||||
_: require("lodash")
|
||||
};
|
||||
var smartenv = {}; //create smartenv object
|
||||
smartenv.items = {}; // create the items object to store items to.
|
||||
smartenv.makeGlobal = function () {
|
||||
addToGlobal(smartenv, "smartenv"); //add object smartenv as global["smartenv"]
|
||||
};
|
||||
smartenv.info = function () {
|
||||
var pck = require("./package.json");
|
||||
beautylog.log("node version is " + process.version + " and smartenv version is " + pck.version);
|
||||
beautylog.log("the smartenv module currently holds the following properties:");
|
||||
console.log(Object.getOwnPropertyNames(smartenv.items).sort());
|
||||
};
|
||||
smartenv.register = function (objectArg, paramName) {
|
||||
if (paramName === void 0) { paramName = "undefined"; }
|
||||
if (paramName == "undefined") {
|
||||
beautylog.error("paramName is undefined");
|
||||
return;
|
||||
smartenv.getEnv = SmartenvEnvironment.init();
|
||||
smartenv.obs = SmartenvObjectStorage.init();
|
||||
/* ----------------------------------------- *
|
||||
* ----- print info ------------------------ *
|
||||
* ----------------------------------------- */
|
||||
smartenv.printEnv = function () {
|
||||
if (smartenv.getEnv().isNode) {
|
||||
var smartenvVersion = require("./package.json").version;
|
||||
plugins.beautylog.log("node version is " + smartenv.getEnv().nodeVersion + " and smartenv version is " + smartenvVersion);
|
||||
}
|
||||
smartenv.items[paramName] = objectArg;
|
||||
};
|
||||
smartenv.get = function (keyName) {
|
||||
return smartenv.items[keyName];
|
||||
else {
|
||||
plugins.beautylog.log("browser is " + smartenv.getEnv().userAgent);
|
||||
}
|
||||
plugins.beautylog.log("the smartenv registration store currently holds the following properties:");
|
||||
console.log(Object.getOwnPropertyNames(smartenv.obs.getComplete).sort());
|
||||
};
|
||||
module.exports = smartenv;
|
||||
//# sourceMappingURL=index.js.map
|
@ -1 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,IAAI,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC;AAC3C,IAAI,WAAW,GAAG,UAAS,SAAS,EAAC,SAAS;IAC1C,MAAM,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC;AAClC,CAAC,CAAC;AACF,IAAI,QAAQ,GAAO,EAAE,CAAC,CAAC,wBAAwB;AAC/C,QAAQ,CAAC,KAAK,GAAG,EAAE,CAAC,CAAC,6CAA6C;AAClE,QAAQ,CAAC,UAAU,GAAG;IAClB,WAAW,CAAC,QAAQ,EAAC,UAAU,CAAC,CAAC,CAAA,2CAA2C;AAChF,CAAC,CAAC;AAGF,QAAQ,CAAC,IAAI,GAAG;IACZ,IAAI,GAAG,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACpC,SAAS,CAAC,GAAG,CAAC,kBAAkB,GAAG,OAAO,CAAC,OAAO,GAAG,2BAA2B,GAAG,GAAG,CAAC,OAAO,CAAC,CAAC;IAChG,SAAS,CAAC,GAAG,CAAC,+DAA+D,CAAC,CAAC;IAC/E,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,mBAAmB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;AACnE,CAAC,CAAC;AAEF,QAAQ,CAAC,QAAQ,GAAG,UAAS,SAAS,EAAC,SAAuB;IAAvB,yBAAuB,GAAvB,uBAAuB;IAC1D,EAAE,CAAC,CAAC,SAAS,IAAI,WAAW,CAAC,CAAA,CAAC;QAC1B,SAAS,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC;QAC1C,MAAM,CAAC;IACX,CAAC;IACD,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC;AAC1C,CAAC,CAAC;AACF,QAAQ,CAAC,GAAG,GAAG,UAAS,OAAO;IAC3B,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AACnC,CAAC,CAAA;AAED,MAAM,CAAC,OAAO,GAAG,QAAQ,CAAC"}
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,4CAA4C;AAC5C,gDAAgD;AAChD,kDAAkD;AAClD,IAAI,OAAO,GAAG;IACV,SAAS,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC;IACrC,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC;CACvB,CAAA;AACD,IAAI,QAAQ,GAAO,EAAE,CAAC,CAAC,wBAAwB;AAE/C,QAAQ,CAAC,MAAM,GAAG,mBAAmB,CAAC,IAAI,EAAE,CAAC;AAC7C,QAAQ,CAAC,GAAG,GAAG,qBAAqB,CAAC,IAAI,EAAE,CAAC;AAG5C;;+CAE+C;AAC/C,QAAQ,CAAC,QAAQ,GAAG;IAChB,EAAE,CAAC,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;QAC3B,IAAI,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC,OAAO,CAAC;QACxD,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,kBAAkB,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,WAAW,GAAG,2BAA2B,GAAG,eAAe,CAAC,CAAC;IAC9H,CAAC;IAAC,IAAI,CAAC,CAAC;QACJ,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,aAAa,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,SAAS,CAAC,CAAA;IACtE,CAAC;IACD,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,2EAA2E,CAAC,CAAC;IACnG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,mBAAmB,CAAC,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;AAC7E,CAAC,CAAC;AAIF,MAAM,CAAC,OAAO,GAAG,QAAQ,CAAC"}
|
54
ts/index.ts
54
ts/index.ts
@ -1,31 +1,31 @@
|
||||
/// <reference path="typings/tsd.d.ts" />
|
||||
var beautylog = require("beautylog")("os");
|
||||
var addToGlobal = function(objectArg,paramName) {
|
||||
global[paramName] = objectArg;
|
||||
};
|
||||
var smartenv:any = {}; //create smartenv object
|
||||
smartenv.items = {}; // create the items object to store items to.
|
||||
smartenv.makeGlobal = function() {
|
||||
addToGlobal(smartenv,"smartenv");//add object smartenv as global["smartenv"]
|
||||
};
|
||||
|
||||
|
||||
smartenv.info = function() {
|
||||
var pck = require("./package.json");
|
||||
beautylog.log("node version is " + process.version + " and smartenv version is " + pck.version);
|
||||
beautylog.log("the smartenv module currently holds the following properties:");
|
||||
console.log(Object.getOwnPropertyNames(smartenv.items).sort());
|
||||
};
|
||||
|
||||
smartenv.register = function(objectArg,paramName = "undefined") {
|
||||
if (paramName == "undefined"){
|
||||
beautylog.error("paramName is undefined");
|
||||
return;
|
||||
}
|
||||
smartenv.items[paramName] = objectArg;
|
||||
};
|
||||
smartenv.get = function(keyName) {
|
||||
return smartenv.items[keyName];
|
||||
/// <reference path="smartenv.classes.ts" />
|
||||
/// <reference path="smartenv.environment.ts" />
|
||||
/// <reference path="smartenv.objectstorage.ts" />
|
||||
var plugins = {
|
||||
beautylog: require("beautylog")("os"),
|
||||
_: require("lodash")
|
||||
}
|
||||
var smartenv:any = {}; //create smartenv object
|
||||
|
||||
smartenv.getEnv = SmartenvEnvironment.init();
|
||||
smartenv.obs = SmartenvObjectStorage.init();
|
||||
|
||||
|
||||
/* ----------------------------------------- *
|
||||
* ----- print info ------------------------ *
|
||||
* ----------------------------------------- */
|
||||
smartenv.printEnv = function() {
|
||||
if (smartenv.getEnv().isNode) {
|
||||
var smartenvVersion = require("./package.json").version;
|
||||
plugins.beautylog.log("node version is " + smartenv.getEnv().nodeVersion + " and smartenv version is " + smartenvVersion);
|
||||
} else {
|
||||
plugins.beautylog.log("browser is " + smartenv.getEnv().userAgent)
|
||||
}
|
||||
plugins.beautylog.log("the smartenv registration store currently holds the following properties:");
|
||||
console.log(Object.getOwnPropertyNames(smartenv.obs.getComplete).sort());
|
||||
};
|
||||
|
||||
|
||||
|
||||
module.exports = smartenv;
|
||||
|
21
ts/smartenv.classes.ts
Normal file
21
ts/smartenv.classes.ts
Normal file
@ -0,0 +1,21 @@
|
||||
/// <reference path="index.ts" />
|
||||
class Environment {
|
||||
public runtimeEnv:string;
|
||||
public userAgent:string;
|
||||
public nodeVersion;
|
||||
public isBrowser:boolean;
|
||||
public isNode:boolean;
|
||||
constructor(runtimeEnvArg,userAgentArg = "undefined") {
|
||||
this.runtimeEnv = runtimeEnvArg;
|
||||
this.userAgent = userAgentArg;
|
||||
if(runtimeEnvArg == "node"){
|
||||
this.isBrowser = false;
|
||||
this.isNode = true;
|
||||
this.nodeVersion = process.version;
|
||||
} else {
|
||||
this.isBrowser = true;
|
||||
this.isNode = true;
|
||||
this.nodeVersion = "undefined";
|
||||
}
|
||||
};
|
||||
}
|
25
ts/smartenv.environment.ts
Normal file
25
ts/smartenv.environment.ts
Normal file
@ -0,0 +1,25 @@
|
||||
/// <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;
|
||||
};
|
||||
}
|
||||
}
|
26
ts/smartenv.objectstorage.ts
Normal file
26
ts/smartenv.objectstorage.ts
Normal file
@ -0,0 +1,26 @@
|
||||
/// <reference path="index.ts" />
|
||||
module SmartenvObjectStorage {
|
||||
export function init() {
|
||||
var obs:any = {};
|
||||
var obsItems:any = {};
|
||||
obs.addItem = function(objectArg,paramName = "undefined") {
|
||||
if (paramName == "undefined"){
|
||||
plugins.beautylog.error("paramName is undefined");
|
||||
return;
|
||||
}
|
||||
obsItems[paramName] = objectArg;
|
||||
};
|
||||
obs.getItem = function(keyName) {
|
||||
return obsItems[keyName];
|
||||
};
|
||||
obs.getComplete = function () {
|
||||
return obsItems;
|
||||
}
|
||||
|
||||
obs.addComplete = function(itemsArg) {
|
||||
obsItems = plugins._.assign(obsItems,itemsArg);
|
||||
return obsItems;
|
||||
};
|
||||
return obs;
|
||||
}
|
||||
}
|
14
ts/test.js
14
ts/test.js
@ -2,12 +2,14 @@
|
||||
var smartenv = require("./index.js");
|
||||
var beautylog = require("beautylog")("os");
|
||||
beautylog.info("Now testing the smartenv module");
|
||||
smartenv.info();
|
||||
smartenv.printEnv();
|
||||
beautylog.info("Now testing the smartenv module");
|
||||
smartenv.register({ key1: "Peter" }, "docit");
|
||||
smartenv.info();
|
||||
beautylog.log(smartenv.get("docit").key1);
|
||||
smartenv.makeGlobal();
|
||||
beautylog.log(global.smartenv.get("docit").key1);
|
||||
smartenv.obs.addItem({ key1: "Peter" }, "docit");
|
||||
smartenv.printEnv();
|
||||
beautylog.log(smartenv.obs.getItem("docit").key1);
|
||||
beautylog.log(smartenv.obs.getItem("docit").key1);
|
||||
var key2 = "hello";
|
||||
smartenv.obs.getItem("docit").key2 = key2;
|
||||
beautylog.log(smartenv.obs.getItem("docit").key2);
|
||||
beautylog.success("Success!");
|
||||
//# sourceMappingURL=test.js.map
|
@ -1 +1 @@
|
||||
{"version":3,"file":"test.js","sourceRoot":"","sources":["test.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,IAAI,QAAQ,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;AACrC,IAAI,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC;AAC3C,SAAS,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC;AAClD,QAAQ,CAAC,IAAI,EAAE,CAAC;AAChB,SAAS,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC;AAClD,QAAQ,CAAC,QAAQ,CAAC,EAAC,IAAI,EAAC,OAAO,EAAC,EAAC,OAAO,CAAC,CAAC;AAC1C,QAAQ,CAAC,IAAI,EAAE,CAAC;AAChB,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC;AAC1C,QAAQ,CAAC,UAAU,EAAE,CAAC;AACtB,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC;AACjD,SAAS,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC"}
|
||||
{"version":3,"file":"test.js","sourceRoot":"","sources":["test.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,IAAI,QAAQ,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;AACrC,IAAI,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC;AAC3C,SAAS,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC;AAClD,QAAQ,CAAC,QAAQ,EAAE,CAAC;AACpB,SAAS,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC;AAClD,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,EAAC,IAAI,EAAC,OAAO,EAAC,EAAC,OAAO,CAAC,CAAC;AAC7C,QAAQ,CAAC,QAAQ,EAAE,CAAC;AACpB,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC;AAClD,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC;AAElD,IAAI,IAAI,GAAG,OAAO,CAAC;AACnB,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC;AAC1C,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC;AAElD,SAAS,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC"}
|
16
ts/test.ts
16
ts/test.ts
@ -2,11 +2,15 @@
|
||||
var smartenv = require("./index.js");
|
||||
var beautylog = require("beautylog")("os");
|
||||
beautylog.info("Now testing the smartenv module");
|
||||
smartenv.info();
|
||||
smartenv.printEnv();
|
||||
beautylog.info("Now testing the smartenv module");
|
||||
smartenv.register({key1:"Peter"},"docit");
|
||||
smartenv.info();
|
||||
beautylog.log(smartenv.get("docit").key1);
|
||||
smartenv.makeGlobal();
|
||||
beautylog.log(global.smartenv.get("docit").key1);
|
||||
smartenv.obs.addItem({key1:"Peter"},"docit");
|
||||
smartenv.printEnv();
|
||||
beautylog.log(smartenv.obs.getItem("docit").key1);
|
||||
beautylog.log(smartenv.obs.getItem("docit").key1);
|
||||
|
||||
var key2 = "hello";
|
||||
smartenv.obs.getItem("docit").key2 = key2;
|
||||
beautylog.log(smartenv.obs.getItem("docit").key2);
|
||||
|
||||
beautylog.success("Success!");
|
Reference in New Issue
Block a user