How would I create a function that accepts a value and creates a watchfile listener based on that value received?
Example of what I'm trying to do:
function createListener(id) {
var listener(id here) = fs.watchFile(file, function () {
});
});
How could I place the id given to function createListener(); into the listener's assigned variable?
Example: createListener('5'); would create var listener5 = fs.watchFile();
createListener('23'); would create var listener23 = fs.watchFile();
watching = {}; watching[id] = fs.watchFile(); var listener = watching[id];