Hybrid View

  1. #1
    Sencha User kostysh's Avatar
    Join Date
    Nov 2011
    Location
    Odessa, Ukraine
    Posts
    175
    Vote Rating
    19
    kostysh will become famous soon enough kostysh will become famous soon enough

      1  

    Default OnlineManager for Sencha Touch

    OnlineManager for Sencha Touch


    Useful utility for detection of the online status, and something else
    Initial release on GitHub: https://github.com/kostysh/Online-Ma...r-Sencha-Touch

    Features:
    • Detection of the online status (real, not only connection)
    • Events: exception, beforeonline, beforeoffline, onlinechange, online, offline
    Code:
    OnlineManager.on({    
        'onlinechange': function(mode) {
            if (mode) {
                console.log('We are online');
            } else {
                console.log('We are offline');
            }
        }
    });
    
    OnlineManager.start();

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,078
    Vote Rating
    467
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    Thank you for the contribution.

    Scott.

  3. #3
    Sencha User jerome76's Avatar
    Join Date
    Apr 2012
    Location
    New Jersey
    Posts
    1,149
    Vote Rating
    99
    jerome76 is just really nice jerome76 is just really nice jerome76 is just really nice jerome76 is just really nice jerome76 is just really nice

      0  

    Default


    Thanks kostysh! I will try it out

    Note: this requires the apps to be native to have access to device.Connection

  4. #4
    Sencha User kostysh's Avatar
    Join Date
    Nov 2011
    Location
    Odessa, Ukraine
    Posts
    175
    Vote Rating
    19
    kostysh will become famous soon enough kostysh will become famous soon enough

      0  

    Default


    Quote Originally Posted by jerome76 View Post
    Note: this requires the apps to be native to have access to device.Connection
    it is not necessary. In web-app Ext.device.Connection works in Simulator mode - it is all what is need for our task

  5. #5
    Sencha User jerome76's Avatar
    Join Date
    Apr 2012
    Location
    New Jersey
    Posts
    1,149
    Vote Rating
    99
    jerome76 is just really nice jerome76 is just really nice jerome76 is just really nice jerome76 is just really nice jerome76 is just really nice

      0  

    Default


    If it isn't a native web-app, it wont have access to the libraries in Ext.device. I tried adding it to one of my web-apps and ran it in Chrome and it did not work.

  6. #6
    Sencha User kostysh's Avatar
    Join Date
    Nov 2011
    Location
    Odessa, Ukraine
    Posts
    175
    Vote Rating
    19
    kostysh will become famous soon enough kostysh will become famous soon enough

      0  

    Default


    but it works fine in my non-native app
    look into official docs: http://docs.sencha.com/touch/2-0/#!/...ice.Connection
    Both the Sencha Packager and PhoneGap implementations will use the native functionality to determine if the current device is online. The Simulator version will simply use navigator.onLine.
    confirm that in Chrome (desktop) isOnline method works and uses navigator...

  7. #7
    Sencha User jerome76's Avatar
    Join Date
    Apr 2012
    Location
    New Jersey
    Posts
    1,149
    Vote Rating
    99
    jerome76 is just really nice jerome76 is just really nice jerome76 is just really nice jerome76 is just really nice jerome76 is just really nice

      0  

    Default


    You gave a local link but I checked the docs. I am not using PhoneGap or Sencha Packager.

    When I request navigator.onLine in the console, that works.

Thread Participants: 2

Tags for this Thread