We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Example Mockup of what this would consist of. Being able to pass other FileWatch services into this Blueprint would be ideal but not a requirement.
class FileWatcher { constructor ( file, data, callback, chokidarOptions, dispose ) { const handleWatchEvent = (event) => { if ( event === 'rename' || event === 'unlink' ) { this.fsWatcher.close(); dispose(); callback(); } else { // this is necessary because we get duplicate events... const contents = fs.readFileSync( file, 'utf-8' ); if ( contents !== data ) { data = contents; callback(); } } }; try { if (chokidarOptions) { this.fsWatcher = chokidar.watch(file, chokidarOptions).on('all', handleWatchEvent); } else { this.fsWatcher = fs.watch( file, opts, handleWatchEvent); } this.fileExists = true; } catch ( err ) { if ( err.code === 'ENOENT' ) { // can't watch files that don't exist (e.g. injected // by plugins somehow) this.fileExists = false; } else { throw err; } } } close () { this.fsWatcher.close(); } }
The text was updated successfully, but these errors were encountered:
bugs181
No branches or pull requests
Example Mockup of what this would consist of. Being able to pass other FileWatch services into this Blueprint would be ideal but not a requirement.
The text was updated successfully, but these errors were encountered: