فهرست منبع

fix(ios): delay unlink event by 500ms

Andelf 3 سال پیش
والد
کامیت
df70190f60
1فایلهای تغییر یافته به همراه6 افزوده شده و 4 حذف شده
  1. 6 4
      ios/App/App/FsWatcher.swift

+ 6 - 4
ios/App/App/FsWatcher.swift

@@ -48,10 +48,12 @@ public class FsWatcher: CAPPlugin, PollingWatcherDelegate {
         // NOTE: Event in js {dir path content stat{mtime}}
         switch event {
         case .Unlink:
-            self.notifyListeners("watcher", data: ["event": "unlink",
-                                                   "dir": baseUrl?.description as Any,
-                                                   "path": url.description,
-                                                  ])
+            DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
+                self.notifyListeners("watcher", data: ["event": "unlink",
+                                                       "dir": self.baseUrl?.description as Any,
+                                                       "path": url.description,
+                                                      ])
+            }
         case .Add, .Change:
             var content: String? = nil
             if url.shouldNotifyWithContent() {