alallier/reload

how to declare watch var?

cekvenich opened this issue · 8 comments

In the docs you mention:
watch.watchTree(__dirname + "/public", function (f, curr, prev) {

How do I make a watch variable so I can use it?

Reload doesn't watch for variables it watches for file changes in directories (if you set it up that way).

What are you exactly trying to do and I can try and help further

Closing due to inactivity. Feel free to add additional details at any time and I'll be happy to assist

I did not see the first comment.
I want to get 'watch'. How do I make watch. eg
let watch = xyz
watch.foo()

So what is xyz?

Reload cannot watch a variable. If you want to include some other module to do that or write your own module you can do it that way. Once you have something to watch the variable you can manually fire reload via reloadServer.reload()

I don't want to watch a variable. I want watch as an instance, so I can call methods.
eg: var app = express()
See, now I have app. I can call methods on app. Your docs don't say how to instantiate 'watch'
Your code block:
watch.watchTree(....

That does not run! As there is nothing called watch.
Your docs don't say how to create 'watch'.
So one can't call methods on it.

I need to update the docs I suppose but the example is using this package Watch.

That is what I was looking for in that link.
var watch = require('watch')
watch.createMonitor('/home/mikeal', function (monitor) {
monitor.files['/home/mikeal/.zshrc'] //

Perfect. Per what you pointed out I opened an issue (#161) to make that example complete