* Set the alert before unload in case it's requested * and there are unsaved changes * @private
(m: any, v: any, opts: ObjectAny)
| 430 | * @private |
| 431 | */ |
| 432 | updateChanges(m: any, v: any, opts: ObjectAny) { |
| 433 | const stm = this.Storage; |
| 434 | const changes = this.getDirtyCount(); |
| 435 | |
| 436 | if (!opts.isClear) { |
| 437 | this.updateItr && clearTimeout(this.updateItr); |
| 438 | this.updateItr = setTimeout(() => this.trigger(EditorEvents.update)); |
| 439 | } |
| 440 | |
| 441 | if (this.config.noticeOnUnload) { |
| 442 | window.onbeforeunload = changes ? () => true : null; |
| 443 | } |
| 444 | |
| 445 | if (stm.isAutosave() && changes >= stm.getStepsBeforeSave()) { |
| 446 | this.store().catch((err) => this.logError(err)); |
| 447 | } |
| 448 | } |
| 449 | |
| 450 | /** |
| 451 | * Load generic module |
nothing calls this directly
no test coverage detected