async _shouldIgnoreEvent (winId, pathname, type, usePolling) {
    if (type === 'file') {
      const { _ignoreChangeEvents } = this
      const currentTime = new Date()
      for (let i = 0; i < _ignoreChangeEvents.length; ++i) {
        const { windowId, pathname: pathToIgnore, start, duration } = _ignoreChangeEvents[i]
        if (windowId === winId && pathToIgnore === pathname) {
          _ignoreChangeEvents.splice(i, 1)
          --i

          // Modification origin is the editor and we should ignore the event.
          if (currentTime - start < duration) {
            return true
          }

          // Try to catch cloud drives that emit the change event not immediately or re-sync the change (GH#3044).
          if (!usePolling) {
            try {
              const fileInfo = await fsPromises.stat(pathname)
              if (fileInfo.mtime - start < duration) {
                if (global.MARKTEXT_DEBUG_VERBOSE >= 3) {
                  console.log(`Ignoring file event after "stat": current="${currentTime}", start="${start}", file="${fileInfo.mtime}".`)
                }
                return true
              }
            } catch (error) {
              console.error('Failed to "stat" file to determine modification time:', error)
            }
          }
        }
      }
    }
    return false
  }
Check whether we should ignore the current event because the file may be changed from MarkText itself.

@param {number} winId
@param {string} pathname
@param {string} type
@param {boolean} usePolling