Skip to content
This repository has been archived by the owner on Sep 16, 2021. It is now read-only.

Parcels; going on background on web pauses loading #290

Open
smvilar opened this issue Jun 26, 2015 · 3 comments
Open

Parcels; going on background on web pauses loading #290

smvilar opened this issue Jun 26, 2015 · 3 comments

Comments

@smvilar
Copy link

smvilar commented Jun 26, 2015

  • Is there a way to prevent this?
  • Is this behaviour ever wanted?
@ruby0x1
Copy link
Member

ruby0x1 commented Jun 26, 2015

Would you mind elaborating what you mean?

@smvilar
Copy link
Author

smvilar commented Jun 27, 2015

Sure.

When loading assets, a parcel will pause the process when switching to another browser tab. That means I need to stay on the tab while the game loads to see any progress.

@ruby0x1
Copy link
Member

ruby0x1 commented Jun 27, 2015

Ah background tab I see I see.

This isn't intentional but it's how the main loop works on the browser, it is using requestAnimationFrame which potentially gets slowed or suspended entirely when backgrounded.
Currently the Promises are stepped by the main loop, which is what the loading would use which is why they're paused that way.

I'll look into it using setImmediate/setTimeout - but I will be careful with this causing state problems. For example, if you do actually pause the loop manually when backgrounded or losing focus, you wouldn't want the promises controlled by the browser - and just arriving when things aren't supposed to be happening.

Thanks for the report!

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

No branches or pull requests

2 participants