-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathDefaultFileWatcherFactory.swift
More file actions
24 lines (21 loc) · 1.16 KB
/
DefaultFileWatcherFactory.swift
File metadata and controls
24 lines (21 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import Foundation
public class DefaultFileWatcherFactory: FileWatcherFactory {
public init() {}
public func createFileWatcher(fileURL: URL, dispatchQueue: DispatchQueue?,
onFileModified: (() -> Void)? = nil, onFileDeleted: (() -> Void)? = nil, onFileRenamed: (() -> Void)? = nil) -> FileWatcherProtocol {
return SingleFileWatcher(fileURL: fileURL,
dispatchQueue: dispatchQueue,
onFileModified: onFileModified,
onFileDeleted: onFileDeleted,
onFileRenamed: onFileRenamed
)
}
public func createDirectoryWatcher(watchedPaths: [URL], changePublisher: @escaping PublisherType,
publishInterval: TimeInterval) -> DirectoryWatcherProtocol {
return BatchingFileChangeWatcher(watchedPaths: watchedPaths,
changePublisher: changePublisher,
publishInterval: publishInterval,
fsEventProvider: FileChangeWatcherFSEventProvider()
)
}
}