Add an option to choose to save a file automatically or by pressing CMD+S

This will help a lot of things, example:

  1. When the Node.js project is big, it tries to restart again and again even when a single character is pressed in the code file.
  2. When I am working on live website and modifying a javascript file, it is very likely that when I am typing the code, the clients of that website will see it broken.

Please forgive me if this feature is already there and I do not see it.
There should be an option to select/deselect “Auto Save”.

NOTE: Please do not confuse it with Refresh App on Changes features. That feature is just for stopping the HTML output page of the App from reloading.

Also, watch.json will not help, please check my explanation below: Add an option to choose to save a file automatically or by pressing CMD+S

Cheers!

There is already a feature request for this and this is already a feature. Go to the project settings, and turn off refresh on edit then refresh your page.

1 Like

Thanks for the heads up.
Yes, that helps preventing a Node.js App from restarting.

But, let’s say when that Node.js app is already up and is serving a JS file and let’s say now I am editing the JS file? You got my point? The file is still saved automatically and it will ruin the site while I am typing.

:man_facepalming: I just described what it did.

The page restarts cause the container restarts.

I am working on a boosted production app.
Do not want any restart or saving to happen until I want it to. :slightly_smiling_face:

You should look into the watch.json file in that case:

1 Like

No. That does not solve.
When my Node.js App is already LIVE and I am editing a static JS file (browser one and not the Node.js one), it will save the contents of the static JS file to disk as soon as I type. Restart of Node.js app does not even matter in this case.

So, a function on a LIVE website‘s static JS file will be:

function() {
  alert(“He is still typing so I am breaking it on the LIVE si

Or, let’s say it was an HTML file:
Restart of Node.js App does not happen for HTML files but it will still break the LIVE website.

<div class=“see-he-is-still-typing”>
  I am breaking up with you.
</

Maybe watch.json file will helps you out.

Read here for How

@RiversideRocks just said that in a post above.

1 Like

I checked that.

The throttle time specifies the time to wait after a change began to happen and when that change is applied. It currently only affects server-side events. So for example, the following tells the container to apply changes after 10,000 milliseconds, or 10 seconds:

"throttle": 10000

So, this does not solve it. Let’s say I make it 30 seconds.
There are more problems:

  • Why will I wait for 30 seconds to see a change online, while it can be done just by typing and then pressing CMD+S.
  • Let’s say I was in the middle of writing a function and it is broken and incomplete and power goes off for any reason. Glitch with update my website in 30 seconds and it will be broken until power is back or any kind of emergency is over. In this case also, saving only via CMD+S will help me.

An ability to disable “Auto Save” and save the file only by pressing CMD+S will be great.
The changes should be saved somewhere temporarily when the file is being edited so if the browser window gets closed by mistake or because of anything else, it will restore the temporarily saved version of the file so that we can continue and press CMD+S to ACTUALLY save it.

I will not mind even if the Node.js App restarts itself automatically when CMD+S is pressed. But, for God’s sake at least let me think and work on my code and type all the calculations without having to worry for things getting broken because of “Auto Save”.

Anyways, for now, I have started using GitHub pages for serving static HTML, CSS, JS etc. files.
For that I have to press CMD+Shift+E every time I have made changes to export to GitHub.

But, it is a pain to check GitHub changes online because of cache and all that, otherwise it is ok.
I would have gone for surge.sh too, but it has rate limits.

An issue is that it would use more storage, since they would need to make a temp save of the changes before applying to project files, and more code to get either the code file or the temp file, I think that a toggle for auto-restart would be easier and lighter for Glitch.
If they don’t save on a temp file than it would be saved locally, causing all changes to be lost on a power outage, or anything that closes/reloads the tab.

I made a suggestion for a toggle button + a manual restart button to

Please read the whole thread again with all my explanations.
It is not JUST about restart of the Node.js app, it is about the static files I am serving with or without Node.js app.

About space, as soon as CMD+S is pressed, there will be no temporary file as changes will be written already. There will not many files people will be writing without actually saving (without CMD+S). This temporary storage should be just 0.1% to 1% of the whole project depending on the project size.

You could use tamper monkey to add Mousetrap and the globals and then fetched a PHP file which would run refresh

1 Like