7 Replies Latest reply on Jun 10, 2014 3:36 AM by Hayden Eastman

    Hourglass API in javascript?

    Ruben Ruben

      Hi,

       

      I'm wondering if Hourglass exists in the javascript API. If so, how do I use it?

       

      Thanks.

        • Re: Hourglass API in javascript?
          Jon Tara

          What's Hourglass?

           

          Ah... apparently, old RhoElements 2.2 feature. This *is* Javascript, isn't it?

           

          Doesn't seem present in 4.x documentation.

            • Re: Hourglass API in javascript?
              Ruben Ruben

              Yes, I expected that even though it doesn't appear in the 4.x docs, it would still be present (since the 2.2 references it as beeing available in javascript). I don't know if the feature itself is done in Javascript or uses some sort of native UI elements, back with ruby + jquerymobile, page transitions gave the user feedback that something was beeing done after triggering a view change or action.

              But now, with AngularJS/Bootstrap, i'm having trouble using page transitions, and thought this would give the feedback that I'm looking for.

               

              Could anyone confirm if this still exists somewhere?

                • Re: Hourglass API in javascript?
                  Jon Tara

                  When in Rome... er,

                   

                  when Bootstrapping, do what the Bootstrappers do.

                   

                  How do Angular/Bootstrap projects do this?

                   

                  Both page transitions and "loading" indication are impossible unless you are Ajax-ing in pages. If you're simply loading new documents, it's not possible to do either one.

                   

                  Bootstrap is a nice option for low-end hardware, because it is much simpler/smaller than jQuery Mobile. Bootstrap is a very popular option for small "appliances" that have very limited memory. The downside is each page is a document, so you don't get nice page transitions. But it's small/fast so you usually don't notice.

                   

                  What is it you are doing that needs a wait indication for the user?!

                   

                  I think using Angular in a Rhodes project is counter-productive, though. Now you add more Javascript to do a job that Ruby does much better. It doesn't make sense to me. Get lean and mean with Bootstrap, and then balloon the Javascript back up with Angular.

                    • Re: Hourglass API in javascript?
                      Ruben Ruben

                      Most solutions do something like this: Angularjs found great solution to display AJAX spinner loading widget | Lemoncode

                       

                      I'm not that familiar with web development, but if I have understood correctly, what it does is try to intercept http requests and run some code when the requests start and when they end (to show or hide spinner, for example). However, looking at the solution, it feels it is kind of an overkill.

                       

                      I want to give the user feedback because some of the devices i'm targeting have problematic touch screens. Without feedback, sometimes the user may think he has pressed correctly a button, but the screen won't agree. Without feedback, the user is left wondering if the app really got the touch event in the correct place or not. I agree that the wait times are not high at all (max 1-2 secs), but after 10 times of waiting 1-2 secs, you really miss some loading indicator.

                        • Re: Hourglass API in javascript?
                          Jon Tara

                          The Angular solution you pointed to is for Ajax requests. Are you doing Ajax requests to replace part of a document? Or just re-loading the document? If the latter, this will not work.

                           

                          I'm not that familiar with Angular. I don't see any use for it in my projects, as I'd much prefer to write my MVC in Ruby. Does Angular have page loading using Ajax like jQuery Mobile? And if so, are you using that feature?


                          Do you provide feedback on buttons? If you change button color or do some other highlighting, that would seem to me to be sufficient if your delays are no more than 1-2 seconds. Also, make sure you are dealing with the 400mSec "click" delay (at least on iOS), as that could be a significant part of your delay. (in jQuery Mobile, work around this using vclick).

                           

                          It would be a pretty trivial Rhodes extension to provide a "loading" overlay over the webview. However, this would need to be implemented for each platform you need to support. It certainly would be a useful Rhodes feature.

                           

                          But you do have Rhodes Alerts. Would that work for you? (Probably not, and I don't think it provides for transparency, and the box and background color are probably not desirable.)

                           

                          What I would really like to see is something similar to the Native Tabbar, but without the tab bar. I've been gently prodding that there is no logical reason to a multiple-webview extension to a tabbar extension. Either one has use without the other. Take the Native Tabbar, get rid of the tabs, and give it an API that allows you change views with optional transitions. Then you could pre-load a web document into a WebView and the Native Whatzit (let's call it Native Transition) would do a transition between the WebViews.

                           

                          It might be possible to implement this as a native extension or native view extension. But I think would be much easier as a built-in feature. It would allow the use of simpler Javascript frameworks than jQuery Mobile (or none!) while still having nice transitions between pages.

                           

                          I don't think this would be very difficult to do for one platform, and I might just do this myself (iOS) for some future project if I can't prod Motorola into it. But I don't think I want to tackle this multi-platform.

                          1 of 1 people found this helpful
                            • Re: Hourglass API in javascript?
                              Ruben Ruben

                              Thanks Jon, since I had been tasting lately with more recent android devices, I had forgotten about about the 300ms wait problem. We are using fastclick.js now, and this has indeed improved the speed in our app on devices with older android versions.

                               

                              About the Hourglass API, I'm thinking it may be not so usefull after all since the complex part is knowing when to enable the spinner and when to disable it, and that depends or the framework you have chosen to develop your app.