refactored some functin names within obs module
This commit is contained in:
parent
cab52e1b02
commit
9ec0b49716
8
index.js
8
index.js
@ -60,7 +60,7 @@ var SmartenvEnvironment;
|
|||||||
plugins.beautylog.log("browser is " + this.getEnv().userAgent);
|
plugins.beautylog.log("browser is " + this.getEnv().userAgent);
|
||||||
}
|
}
|
||||||
plugins.beautylog.log("the smartenv registration store currently holds the following properties:");
|
plugins.beautylog.log("the smartenv registration store currently holds the following properties:");
|
||||||
console.log(Object.getOwnPropertyNames(smartenv.obs.getComplete()));
|
console.log(Object.getOwnPropertyNames(smartenv.obs.getAll()));
|
||||||
};
|
};
|
||||||
SmartenvEnvironment.init = function (objectArg) {
|
SmartenvEnvironment.init = function (objectArg) {
|
||||||
objectArg.getEnv = getEnv;
|
objectArg.getEnv = getEnv;
|
||||||
@ -73,7 +73,7 @@ var SmartenvObjectStorage;
|
|||||||
function init() {
|
function init() {
|
||||||
var obs = {};
|
var obs = {};
|
||||||
var obsItems = {};
|
var obsItems = {};
|
||||||
obs.addItem = function (objectArg, paramName) {
|
obs.add = function (objectArg, paramName) {
|
||||||
if (paramName === void 0) { paramName = "undefined"; }
|
if (paramName === void 0) { paramName = "undefined"; }
|
||||||
if (paramName == "undefined") {
|
if (paramName == "undefined") {
|
||||||
plugins.beautylog.error("paramName is undefined");
|
plugins.beautylog.error("paramName is undefined");
|
||||||
@ -81,10 +81,10 @@ var SmartenvObjectStorage;
|
|||||||
}
|
}
|
||||||
obsItems[paramName] = objectArg;
|
obsItems[paramName] = objectArg;
|
||||||
};
|
};
|
||||||
obs.getItem = function (keyName) {
|
obs.get = function (keyName) {
|
||||||
return obsItems[keyName];
|
return obsItems[keyName];
|
||||||
};
|
};
|
||||||
obs.getComplete = function () {
|
obs.getAll = function () {
|
||||||
return obsItems;
|
return obsItems;
|
||||||
};
|
};
|
||||||
obs.addComplete = function (itemsArg) {
|
obs.addComplete = function (itemsArg) {
|
||||||
|
10
test.js
10
test.js
@ -4,11 +4,11 @@ var beautylog = require("beautylog")("os");
|
|||||||
beautylog.info("Now testing the smartenv module");
|
beautylog.info("Now testing the smartenv module");
|
||||||
smartenv.printEnv();
|
smartenv.printEnv();
|
||||||
beautylog.info("Now testing the smartenv module");
|
beautylog.info("Now testing the smartenv module");
|
||||||
smartenv.obs.addItem({ key1: "Peter" }, "docit");
|
smartenv.obs.add({ key1: "Peter" }, "docit");
|
||||||
smartenv.printEnv();
|
smartenv.printEnv();
|
||||||
beautylog.log(smartenv.obs.getItem("docit").key1);
|
beautylog.log(smartenv.obs.get("docit").key1);
|
||||||
beautylog.log(smartenv.obs.getItem("docit").key1);
|
beautylog.log(smartenv.obs.get("docit").key1);
|
||||||
var key2 = "hello";
|
var key2 = "hello";
|
||||||
smartenv.obs.getItem("docit").key2 = key2;
|
smartenv.obs.get("docit").key2 = key2;
|
||||||
beautylog.log(smartenv.obs.getItem("docit").key2);
|
beautylog.log(smartenv.obs.get("docit").key2);
|
||||||
beautylog.success("Success!");
|
beautylog.success("Success!");
|
||||||
|
@ -39,7 +39,7 @@ module SmartenvEnvironment {
|
|||||||
plugins.beautylog.log("browser is " + this.getEnv().userAgent)
|
plugins.beautylog.log("browser is " + this.getEnv().userAgent)
|
||||||
}
|
}
|
||||||
plugins.beautylog.log("the smartenv registration store currently holds the following properties:");
|
plugins.beautylog.log("the smartenv registration store currently holds the following properties:");
|
||||||
console.log(Object.getOwnPropertyNames(smartenv.obs.getComplete()));
|
console.log(Object.getOwnPropertyNames(smartenv.obs.getAll()));
|
||||||
}
|
}
|
||||||
|
|
||||||
export var init = function(objectArg) {
|
export var init = function(objectArg) {
|
||||||
|
@ -3,17 +3,17 @@ module SmartenvObjectStorage {
|
|||||||
export function init() {
|
export function init() {
|
||||||
var obs:any = {};
|
var obs:any = {};
|
||||||
var obsItems:any = {};
|
var obsItems:any = {};
|
||||||
obs.addItem = function(objectArg,paramName = "undefined") {
|
obs.add = function(objectArg,paramName = "undefined") {
|
||||||
if (paramName == "undefined"){
|
if (paramName == "undefined"){
|
||||||
plugins.beautylog.error("paramName is undefined");
|
plugins.beautylog.error("paramName is undefined");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
obsItems[paramName] = objectArg;
|
obsItems[paramName] = objectArg;
|
||||||
};
|
};
|
||||||
obs.getItem = function(keyName) {
|
obs.get = function(keyName) {
|
||||||
return obsItems[keyName];
|
return obsItems[keyName];
|
||||||
};
|
};
|
||||||
obs.getComplete = function () {
|
obs.getAll = function () {
|
||||||
return obsItems;
|
return obsItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
10
ts/test.js
10
ts/test.js
@ -4,12 +4,12 @@ var beautylog = require("beautylog")("os");
|
|||||||
beautylog.info("Now testing the smartenv module");
|
beautylog.info("Now testing the smartenv module");
|
||||||
smartenv.printEnv();
|
smartenv.printEnv();
|
||||||
beautylog.info("Now testing the smartenv module");
|
beautylog.info("Now testing the smartenv module");
|
||||||
smartenv.obs.addItem({ key1: "Peter" }, "docit");
|
smartenv.obs.add({ key1: "Peter" }, "docit");
|
||||||
smartenv.printEnv();
|
smartenv.printEnv();
|
||||||
beautylog.log(smartenv.obs.getItem("docit").key1);
|
beautylog.log(smartenv.obs.get("docit").key1);
|
||||||
beautylog.log(smartenv.obs.getItem("docit").key1);
|
beautylog.log(smartenv.obs.get("docit").key1);
|
||||||
var key2 = "hello";
|
var key2 = "hello";
|
||||||
smartenv.obs.getItem("docit").key2 = key2;
|
smartenv.obs.get("docit").key2 = key2;
|
||||||
beautylog.log(smartenv.obs.getItem("docit").key2);
|
beautylog.log(smartenv.obs.get("docit").key2);
|
||||||
beautylog.success("Success!");
|
beautylog.success("Success!");
|
||||||
//# sourceMappingURL=test.js.map
|
//# 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,CA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AAC;AACzC,QAAQ,CAAC,QAAQ,EAAE,CAAC;AACpB,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC;AAC9C,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC;AAE9C,IAAI,IAAI,GAAG,OAAO,CAAC;AACnB,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC;AACtC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC;AAE9C,SAAS,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC"}
|
10
ts/test.ts
10
ts/test.ts
@ -4,13 +4,13 @@ var beautylog = require("beautylog")("os");
|
|||||||
beautylog.info("Now testing the smartenv module");
|
beautylog.info("Now testing the smartenv module");
|
||||||
smartenv.printEnv();
|
smartenv.printEnv();
|
||||||
beautylog.info("Now testing the smartenv module");
|
beautylog.info("Now testing the smartenv module");
|
||||||
smartenv.obs.addItem({key1:"Peter"},"docit");
|
smartenv.obs.add({key1:"Peter"},"docit");
|
||||||
smartenv.printEnv();
|
smartenv.printEnv();
|
||||||
beautylog.log(smartenv.obs.getItem("docit").key1);
|
beautylog.log(smartenv.obs.get("docit").key1);
|
||||||
beautylog.log(smartenv.obs.getItem("docit").key1);
|
beautylog.log(smartenv.obs.get("docit").key1);
|
||||||
|
|
||||||
var key2 = "hello";
|
var key2 = "hello";
|
||||||
smartenv.obs.getItem("docit").key2 = key2;
|
smartenv.obs.get("docit").key2 = key2;
|
||||||
beautylog.log(smartenv.obs.getItem("docit").key2);
|
beautylog.log(smartenv.obs.get("docit").key2);
|
||||||
|
|
||||||
beautylog.success("Success!");
|
beautylog.success("Success!");
|
Loading…
x
Reference in New Issue
Block a user