How is a hot restart implemented in Meteor JS?

I am interested to know what strategies they use to translate the code to the browser when the file changes, but I did not find anything on the Internet about this. I also searched the code in the GitHub repo to no avail.

So, how is a hot reset implemented in Meteor? Are there any alternatives? Is it possible to implement code and asset reloads using SocketIO in Node?

+4
source share
1 answer

You can run here :

The meteor reaction of reactivity is short and sweet, about 50 lines of code. You can connect to it yourself to add new reactive contexts or data sources using the Meteor.deps module.

Meteor has a simple dependency tracking system, so that it can automatically rewrite patterns and such when session variables are changed or database queries.

Unlike most other systems, you do not need to manually declare these dependencies - it "just works." The mechanism is simple and efficient. When you call a function that supports reactive updates (say, a database query), it automatically saves the current "invalidation context" if it exists (say, the current template being created). Later, when the data changes, it can β€œnullify” this context (say the template for self-learning.) The entire implementation is about 50 lines of code.

Developers, especially package authors, can use revocation contexts to implement additional reactive data sources or to write functions that automatically record dependencies on reactive data sources.

0
source

Source: https://habr.com/ru/post/1437267/


All Articles