Re: Hanging stuff of navigator

On Thursday, May 16, 2013 at 2:51 PM, Alex Russell wrote:
> I have a slight preference for the static methods thing as it tends to be shorter.
> 
> As an exercise, what would it look like to refactor GeoLocation this way?
Like this:

interface Geolocation { 
   static void getCurrentPosition(PositionCallback successCallback,
                           optional PositionErrorCallback errorCallback,
                           optional PositionOptions options);

   static long watchPosition(PositionCallback successCallback,
                      optional PositionErrorCallback errorCallback,
                      optional PositionOptions options);

   static void clearWatch(long watchId);
};


Yes, all those success and error callbacks are screaming for Futures. But it's a bit tricky with the watchPosition() and clearWatch(). A ProgressFuture could work there, but it would need to be cancelable so you can stop watching. 

Anyway, another API I've been trying to refactor to be status is the SysApps Messaging API:

https://gist.github.com/marcoscaceres/5459002

(the original messaging API is here http://messaging.sysapps.org/)

Received on Thursday, 16 May 2013 15:00:20 UTC