Use localStorage with Web Storage API (#23172)

This commit is contained in:
Wendelin
2024-12-10 11:14:15 +01:00
committed by GitHub
parent 008647aa7a
commit 8f19c0abb0
18 changed files with 773 additions and 38 deletions

View File

@@ -487,13 +487,15 @@ export class HaScriptTrace extends LitElement {
if (!traceText) {
return;
}
localStorage.devTrace = traceText;
window.localStorage.setItem("devTrace", traceText);
this._loadLocalTrace(traceText);
}
private _loadLocalStorageTrace() {
if (localStorage.devTrace) {
this._loadLocalTrace(localStorage.devTrace);
const devTrace = window.localStorage.getItem("devTrace");
if (devTrace) {
this._loadLocalTrace(devTrace);
}
}