(value: string, didSubmit: boolean)
| 30 | } |
| 31 | |
| 32 | persist(value: string, didSubmit: boolean): void { |
| 33 | if (!this.shouldPersist()) return; |
| 34 | |
| 35 | if (didSubmit) { |
| 36 | this.store.handleSubmittedDraft(this.draftKey, value); |
| 37 | return; |
| 38 | } |
| 39 | |
| 40 | if (!this.didChange || value === this.initialValue) return; |
| 41 | |
| 42 | if (!value.trim()) { |
| 43 | this.store.clear(this.draftKey); |
| 44 | return; |
| 45 | } |
| 46 | |
| 47 | this.store.set(this.draftKey, value); |
| 48 | } |
| 49 | } |