You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

22 lines
536 B

const serverConfig = require('../config/serverConfig.js') // Server Config
const wrtColor = require('./common/wrtColor')
const fs = require('fs')
function stateMonitor (state) {
setInterval(function() {
// Convert to string
let stateString = JSON.stringify(state, null, 2)
fs.writeFile(serverConfig.stateJsonPath, stateString, (err) => {
if (err) {
throw err
}
// wrtColor.blue("state.json saved")
})
}, serverConfig.stateMonitorRate)
}
module.exports = {
stateMonitor: stateMonitor
}