Live Reload: Is there a hook or variable

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?

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.


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

1 Like

@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?

@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.

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.