add check setTimeout is function or not before invoking it to

Signed-off-by: liwenzhen <liwenzhen3@huawei.com>
Change-Id: Ia019597939e41a23fe1914cfbb7758fbe6f684f8
This commit is contained in:
liwenzhen
2023-01-19 14:41:02 +08:00
parent d47bf64504
commit 2933a9e4ac
+7 -4
View File
@@ -63,10 +63,13 @@ export default class Differ {
this._hasTimer = true; this._hasTimer = true;
// Use setTimeout instead of setTimeoutDiffer // Use setTimeout instead of setTimeoutDiffer
setTimeout(() => { // avoid invoking setTimeout after appDestroy
this._hasTimer = false; if (typeof setTimeout === "function") {
this.flush(); setTimeout(() => {
}, 0); this._hasTimer = false;
this.flush();
}, 0);
}
} }
const map: object[] = this._map; const map: object[] = this._map;
if (!map[defaultDepth]) { if (!map[defaultDepth]) {