如何为 Angular 2+ 的本地存储设置超时?
How can i set timeout for localstorage for Angular 2+?
我想为我的 Angular 2+ 应用程序设置超时。
实际上,我想在大约 20 分钟后 localtorage 被清除。
谢谢
您可以在 ngOnInit 中编写 setTimeout 函数。
ngOnInit(){
setTimeout(()=>{
localStorage.clear();
},time)
}
我想为我的 Angular 2+ 应用程序设置超时。 实际上,我想在大约 20 分钟后 localtorage 被清除。
谢谢
您可以在 ngOnInit 中编写 setTimeout 函数。
ngOnInit(){
setTimeout(()=>{
localStorage.clear();
},time)
}