mdg:reload-on-resume

v1.0.5Published 3 years ago

Meteor reload-on-resume Package

Add it to your Meteor app with meteor add mdg:reload-on-resume. This package changes the behavior of Meteor's hot code push feature on mobile devices only.

Normally, your app will update on the user's device as soon as you push a new version. This process is always smooth in a desktop web browser, but might momentarily interrupt the user's experience if they are on a mobile device.

With this package, the app will only update itself to the newest version if the user closes and re-opens the app (hence, it "reloads on resume").

API

In addition to changing the behavior of hot code push, this package provides a method to check if the app is waiting to be reloaded.

Reload.isWaitingForResume()

A reactive function that returns true if a new version of the app has been downloading and the framework is waiting until the app is closed and reopened. Can be used to display a message to the user that says "new version available, restart the app to update." You can also use window.location.replace(window.location.href) to reload the page to the newest version of the app.