Closed ExperiBass closed 4 years ago
Could you show me the code?
Sorry I was trying to ask for the application code which produced the warning.
The warning is necessary as the given parameter to the callback function possibly be wrong.
oh, here it is:
watcher.on('change', function() { // set up playing status watcher...
game = JSON.parse(fs.readFileSync('./game.json', 'utf8'))
bot.user.setActivity(game.activity) // ...and change the playing status as its updated
})
The above code will not trigger the warning unless you give exactly one argument to the callback:
watcher.on('change', function(name) {
})
Which should be
watcher.on('change', function(event, name) {
})
[edit]
There are two ways to listen to change
const watch = require('node-watch');
watch(__dirname, function(evt, name) {
});
const watch = require('node-watch');
watch(__dirname).on('change', function(evt, name) {
}):
The warning will appear only using callback style once the given argument is exactly ONE. That is:
watch(__dirname, function(name) {
});
So the deprecation warning will never be seen in your code. The warning is necessary anyway and it's by design, at least in the current version.
oh aight, ima close this then. thanks!
Just a warning, no biggie