From e80bd95451c86b81a07fe136b0b822c85bdffcfd Mon Sep 17 00:00:00 2001 From: liwenzhen Date: Thu, 19 Jan 2023 14:41:02 +0800 Subject: [PATCH] fixed 2933a9e from https://gitee.com/liwenzhen3/third_party_jsframework/pulls/785 add check setTimeout is function or not before invoking it to Signed-off-by: liwenzhen Change-Id: Ia019597939e41a23fe1914cfbb7758fbe6f684f8 --- runtime/main/page/api/Differ.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/runtime/main/page/api/Differ.ts b/runtime/main/page/api/Differ.ts index 1726b613..c40314ab 100644 --- a/runtime/main/page/api/Differ.ts +++ b/runtime/main/page/api/Differ.ts @@ -63,10 +63,13 @@ export default class Differ { this._hasTimer = true; // Use setTimeout instead of setTimeoutDiffer - setTimeout(() => { - this._hasTimer = false; - this.flush(); - }, 0); + // avoid invoking setTimeout after appDestroy + if (typeof setTimeout === "function") { + setTimeout(() => { + this._hasTimer = false; + this.flush(); + }, 0); + } } const map: object[] = this._map; if (!map[defaultDepth]) {