fix(ios): delay unlink event by 500ms

pull/6025/head^2
Andelf 2022-07-13 18:14:27 +08:00
parent 5c1ef22e8e
commit df70190f60
1 changed files with 6 additions and 4 deletions

View File

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