(RMarkdownPreviewManager: RMarkdownPreviewManager, filePath: string)
| 60 | } |
| 61 | |
| 62 | private startFileWatcher(RMarkdownPreviewManager: RMarkdownPreviewManager, filePath: string) { |
| 63 | let fsTimeout: NodeJS.Timeout | null; |
| 64 | const fileWatcher = fs.watch(filePath, {}, () => { |
| 65 | const mtime = fs.statSync(filePath).mtime.getTime(); |
| 66 | if (this.autoRefresh && !this.isRendering && !fsTimeout && mtime !== this.mtime) { |
| 67 | fsTimeout = setTimeout(() => { fsTimeout = null; }, 1000); |
| 68 | this.mtime = mtime; |
| 69 | void RMarkdownPreviewManager.updatePreview(this); |
| 70 | } |
| 71 | }); |
| 72 | this.fileWatcher = fileWatcher; |
| 73 | } |
| 74 | |
| 75 | private getHtmlContent(htmlContent: string): void { |
| 76 | let content = htmlContent.replace(/<(\w+)\s+(href|src)="(?!(\w+:)|#)/g, |
no test coverage detected