I have a dataset and processing code shown below:
LIST = [{
"id": "1lqgDs6cZdWBL",
"timeUpdated": "2020-04-22 12:51:23",
"status": "CLOSED"
}, {
"id": "C2Zl9JWfZHSJ",
"timeUpdated": "2020-04-22 12:51:07",
"status": "CLOSED"
}, {
"id": "BHbiVcCaQa2d",
"timeUpdated": "2020-04-15 14:53:12",
"status": "CLOSED"
}];
ngOnInit() {
this.initializeAlertTimer();
}
initializeAlertTimer(data?: any, duration?: any) {
const DURATION = duration ? 20000 : 1000
setTimeout(() => {
}, DURATION)
}
addData() {
const data = {
"id": "qHFw59mujN9X",
"timeCreated": "2020-03-06 12:21:06",
"status": "NEW",
}
this.initializeAlertTimer(data, 20000);
}
My goal is to display the LIST
data in the console only once when the application is opened. Even if there are page changes or reloads, it should not repeat. When clicking on addData()
, new data will be added and the newest data will be displayed through initializeAlertTime()
.