My electron forge webpack template based application is supposed to save content whenever it is closed down. The onUnload successfully runs whenever I with a toolbar button switch to a plain html page which, with the fact that the same code worked before I implemented webpack out of necessity, proves it is due to webpack that componentWillUnMount is never sucessfully called.
onUnload(){
axios.post("http://localhost:2999/calendar/unload", {days:this.useCalendarData, subjects:this.userSubjects, lastWeekErase:this.lastWeekErase})
.catch(err=>{console.log(err)})
}
componentDidMount() {
window.addEventListener("beforeunload", this.onUnload)
}
componentWillUnmount() {
window.removeEventListener("beforeunload", this.onUnload)
}
Is it like possible to delay webpack's hasty termination so that React has time to run?