10.10.10 • Published 9 months ago
wat.js v10.10.10
wat.js
A utility package for real-time functionality using WatchJS.
Installation
You can install this package using npm:
npm install wat.js
Usage
wait
Function
The wait
function is a utility for creating a delay using Promises.
const { wait } = require('wat.js');
(async () => {
console.log('Start');
await wait(1000); // Wait for 1 second
console.log('End');
})();
watch
Function
The watch
function allows you to watch a file for changes and run a copy of it with additional functionality.
const { watch } = require('wat.js');
const watcher = watch('file.js', { someData: 'value' });
// Stop watching after a certain time
setTimeout(() => {
watcher.close();
}, 10000); // Stop after 10 seconds
License
This package is open-source and available under the MIT License.