please some one help me with a code to display flash messages and fade after some times. actually i try somany methods but cant get it.
const timeout = require('timeout-then');
module.exports = function(app){
app.route("/").get(function(req, res, next){
var info= "am trying"
this.alertMsg = (function(msg){
return this.msg = this
console.log(this.msg);
}).bind(info);
//alert function
this.alertTimeout = setTimeout(function(){
this.alertMsg.remove()
}, 3000);
this.date = new Date();
this.round;
this.floor;
this.ceaseAlert = function(){
this.round = Math.round(this.date.getSeconds());
this.floor = Math.floor(this.date.getSeconds());
if(this.floor > this.round){
clearTimeout(this.alertTimeout)
}
}
res.render(__dirname + "/../views/index.pug", { info: this.alertMsg().toString()})
})
}