   fileprivate var mark = Token()
 
   fileprivate let webview: WKWebView
+  fileprivate var monitor: FileSystemEventMonitor?
 
   fileprivate let disposeBag = DisposeBag()
 

import PureLayout
import WebKit
import Swifter

class HtmlPreviewTool: NSView, UiComponent {


    source
      .observeOn(MainScheduler.instance)
      .subscribe(onNext: { [unowned self] state in
        guard let serverUrl = state.htmlPreview.server, let htmlFileUrl = state.htmlPreview.htmlFile else {
          self.monitor = nil
          return
        }

        if serverUrl.mark == self.mark {
          return
        }

        self.monitor = FileSystemEventMonitor(pathsToWatch: [htmlFileUrl.path],
                                             latency: fileSystemEventsLatency,
                                             watchRoot: false,
                                             queue: monitorDispatchQueue)
        { [unowned self] events in
          self.webview.load(URLRequest(url: serverUrl.payload))
        }

        self.mark = serverUrl.mark
