(data: string)
| 79 | this.writeToSessionFile(next) |
| 80 | } |
| 81 | public writeToSessionFile(data: string) { |
| 82 | // optionally write state to file, useful when state cannot be controlled across containers |
| 83 | if (SESSION_STORAGE_PATH) { |
| 84 | try { |
| 85 | writeFile(data, SESSION_STORAGE_PATH, `${this.filePath}.json`) |
| 86 | } catch (err: any) { |
| 87 | logger( |
| 88 | `Failed to write coderoad session to path: ${SESSION_STORAGE_PATH}/${this.filePath}.json: ${err.message}`, |
| 89 | ) |
| 90 | } |
| 91 | } |
| 92 | } |
| 93 | public reset = () => { |
| 94 | this.set(this.defaultValue) |
| 95 | } |