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:
Reload._onMigrate() is a private API that other packages use to register their interest in participating in a reload. That means they can pass on data to migrate to the new version, but they can also delay the reload until they are ready. It can also be used to disable automatic reloads, by simply returning [false] and never calling the retry callback. For an example of delaying a reload and controlling when it happens, see the reload-on-resume package: Note that this only affects when a r…
I am using this feature to prevent hot reloads in certain scenarios, but you can also use it for detecting reloads.
@waldgeist that’s exactly what I was looking for!
@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.