From 9f131a17024c30b568e39d2baa4bffac4916eceb Mon Sep 17 00:00:00 2001 From: lucaspalomodevelop Date: Mon, 31 Oct 2022 12:58:45 +0100 Subject: [PATCH] add states in index.js --- src/index.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/index.js b/src/index.js index b013521..c41be4d 100644 --- a/src/index.js +++ b/src/index.js @@ -7,20 +7,27 @@ var app = {}; app.render = engine.render; app.CONST = engine.CONST; app.renderFile = (filePath) => { + this.setState({ status: 0, statusMSG: "read file" }); let file = fs.readFileSync(filePath, "utf8"); + this.setState({ status: 0, statusMSG: "parse file" }); file = JSON.parse(file); + this.setState({ status: 0, statusMSG: "set Selfpath" }); file["_SELFPATH_"] = path.dirname(filePath); return engine.render(file); }; -app.setStateFunction = function (callback) { - app.stateCallback = callback; -}; app.setState = ({ status, statusMSG }) => { if (app.stateCallback != undefined) { app.stateCallback({ status, statusMSG }); } }; + +app.setStateFunction = function (callback) { + app.stateCallback = callback; + this.setState({ status: 0, statusMSG: "set Statefunction" }); + this.setState({ status: 0, statusMSG: "JSSTE is ready" }); +}; + // app.log = function({status, statusMSG}){ // };