Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pause from client side #60

Closed
xoorath opened this issue Jan 27, 2017 · 7 comments
Closed

Pause from client side #60

xoorath opened this issue Jan 27, 2017 · 7 comments

Comments

@xoorath
Copy link

xoorath commented Jan 27, 2017

Hey,

I'd like to put in a feature request for the client side: I'd like the ability to ignore reload requests.

Use case:

I'm making a video game and a lot of times I want to hot-reload the game when I'm working on the server or client files. However other times I want to be able to freely code without stopping the running game. If we could pause the reloading (effectively: ignore requests) I could add a tickbox to the game page that would allow it to temporarily ignore these reloads.

Thanks for the great tool,
Xoorath

@alallier
Copy link
Owner

This could be achieved with your own vanilla JavaScript

@xoorath
Copy link
Author

xoorath commented Jan 27, 2017

How do I prevent the client reload.js from reloading? Is there some API I'm unaware of?

@alallier
Copy link
Owner

You could add a checkbox that when clicked removes the reload script tag from the DOM. It's a little hacky but it should work for your use case.

@xoorath
Copy link
Author

xoorath commented Jan 27, 2017

I see. I'd still like to leave this open as a feature request, since it should be pretty trivial, not too bloaty, and helpful for some folks.

I'll try getting something to work. Alternatively I may just package my own client-reload.js with my app that has this feature. I'm not sure, but I'll give some workaround a go.

Thanks for the input.

@alallier
Copy link
Owner

alallier commented Jan 27, 2017

The typical use case for reload, is it is active in development mode and not active in production mode.

Typically this is done by having a conditional in the script section of your HTML so something like this (assuming you are using a templating engine):

<if env='development'>
  <script type='text/javascript' src='/js/development.js'></script>
  <script src='/reload/reload.js'></script>
</if>
<else>
  <script type='text/javascript' src='/js/production-min.js'></script>
</else>

Then you just run your app in two different modes depending on what you need. I'm not shutting down your idea. I'm open to others opinions on this ( @jprichardson )

@xoorath
Copy link
Author

xoorath commented Jan 27, 2017

Cool, yeah - that's exactly what I do but with dust.js.

    {#release} {:else}
    <script src="/reload/reload.js"></script>
    {/release}

The use case for me is : I'm developing the game and for example I'm near the end state of "level 5". I want to keep this open as I have further work/profiling/whatever to do, but I want to keep coding.

Being able to pause this reloading can be pretty helpful for me. I can see myself and the rest of my team using this very regularly.

@alallier
Copy link
Owner

@xoorath thank you for opening up this issue, the team ( @jprichardson and I agree) that this type of control should be on a project by project basis, keeping reload as light and simple as possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants