Code Monkey home page Code Monkey logo

Comments (13)

stubailo avatar stubailo commented on May 18, 2024

Have you tried window.location.reload()? That might do what you want, I think.

from mobile-packages.

Slava avatar Slava commented on May 18, 2024

I think location.reload would not do that, as it reloads to meteor.local and doesn't restart the on-device server.

from mobile-packages.

Slava avatar Slava commented on May 18, 2024

Oh wait, I am wrong. The Reload call happens after the new data was downloaded and server restarted (https://github.com/meteor/meteor/blob/devel/packages/autoupdate/autoupdate_cordova.js). location.reload might do the trick :)

from mobile-packages.

lorensr avatar lorensr commented on May 18, 2024

Works in the iOS simulator, thanks! Maybe add that as a possible use of Reload.isWaitingForResume() at the bottom of the readme?

from mobile-packages.

stubailo avatar stubailo commented on May 18, 2024

Great idea, just added that. Thanks!

from mobile-packages.

boustanihani avatar boustanihani commented on May 18, 2024

Is there a meteor package similar to https://atmospherejs.com/mdg/reload-on-resume but for desktop clients? I mean a package that changes the behavior of Meteor's hot code push feature and allows us to attache custom code and define what happens when a new version is downloaded or detected.

I think doing a full page reload (for example by calling window.location.reload()) eliminates the risk of getting some invalid app state and the need to manually reset any variables or components. IMO it is not a big deal if a user needs to refill some form when this happens.

from mobile-packages.

stubailo avatar stubailo commented on May 18, 2024

The way hot code push is implemented currently actually does do a full page reload for exactly this reason. You can attach hooks to reload related events via the reload package, but I don't think the API is well documented. Look at the source code of this package for an example of how to use it.

from mobile-packages.

boustanihani avatar boustanihani commented on May 18, 2024

@stubailo Thanks, good to know :)

You mean I should take a look at this package ? =>
https://github.com/meteor/meteor/tree/devel/packages/reload

from mobile-packages.

stubailo avatar stubailo commented on May 18, 2024

That would also be helpful, but I meant the mdg:reload-on-resume package, since it uses the reload API.

from mobile-packages.

boustanihani avatar boustanihani commented on May 18, 2024

Okay :) I'll take a look.. THX

from mobile-packages.

sasikanth513 avatar sasikanth513 commented on May 18, 2024

If we use window.location.reload() connection to the server is lost and we are getting

Server sent add for existing id: 5JHx7YWauQobBXC7H error

but that record is not existed after the reload.

Is there any smooth way to do this like Reload.update()?

My code

function initializeUpdate(){
      document.addEventListener('resume', function(){
        if(Reload.isWaitingForResume()){
          window.location.reload();
        }
      }, false);
  }
  document.addEventListener("deviceready", initializeUpdate, false);

from mobile-packages.

sasikanth513 avatar sasikanth513 commented on May 18, 2024

This is more of grounddb issue I think
Meteor-Community-Packages/ground-db#22

from mobile-packages.

mitiaptest avatar mitiaptest commented on May 18, 2024

+1

from mobile-packages.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.