mirror of
https://github.com/lucaspalomodevelop/JSSTE.git
synced 2026-03-12 23:17:22 +00:00
add states in index.js
This commit is contained in:
parent
71e3e44e3d
commit
9f131a1702
13
src/index.js
13
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}){
|
||||
|
||||
// };
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user