Live Reload: Is there a hook or variable


#1

I’m working on a test runner, so I’d like to save certain states between live reloads, but not cold starts.

In dev mode, I need a callback to know if it is a live reload, or meteor starting from a cold start.

Is there a hook or variable that can be evaluated?


#2

There is an undocumented function described here:


I am using this feature to prevent hot reloads in certain scenarios, but you can also use it for detecting reloads.


#3

Thanks @waldgeist that’s exactly what I was looking for!


#4

@waldgeist I see this is just for client side. Do you know anything for server-side? I want to listen to an event of the server restarting on file changes, and restore some state. Any ideas?


#5

@benjamn I’m working on dispatch:mocha test runner.

I want All tests to run from a cold start. But I want a specific (dev selected) test to run on hot refreshes (presumably from a file change). Is there a reload event I can listen to on the server side? Can I pass state from before the rebuild to after?

The use case is so that only the test the dev is debugging runs in the test runner while he is working on it.


#6

I am not aware of a hook on the server-side. I guess you would have to look into the details of the app build process. Maybe implementing a build plugin would be an option.