Yeah, I too think they could easily be sync methods. The only thing that I'd be concerned about is if there still is a limitation on iOS where it can't produce sync results. If that is the case I'd stay with a consistent API over sync returns.
Simon Mac Donald http://hi.im/simonmacdonald On Wed, Mar 27, 2013 at 11:36 PM, Marcel Kinard <cmarc...@gmail.com> wrote: > When I look at all the methods in the Globalization API, they should all > execute quickly in a relatively predictable time period. They aren't going > off-box and aren't compute-heavy. So to me as a casual observer, having > them all run async seems like a bit of overkill. I'm not familiar with the > referenced patterns, but what would folks think about having a synchronous > version of these methods? Does that cut-the-chase and make it even more > simple than applying invocation patterns? > > -- Marcel > > On Mar 25, 2013, at 6:21 PM, Ray Camden <rayca...@adobe.com> wrote: > > > This possibly falls into the category of something that should be on the > > Google group (and actually I did ask there too ;) but I think it also > > exposes something not documented very well and maybe this discussion can > > lead to something that can be added to the docs. > > > > I've worked with the Globalization API before (well, for a blog post: > > > http://www.raymondcamden.com/index.cfm/2012/11/15/Testing-Globalization-Sup > > port-in-PhoneGap-22). The API works great, but the async nature of it > > makes it very difficult for what I'd consider to be 'typical' usage. > > > > I'd imagine that - in many cases - a developer would have a set of > dynamic > > data, let's say sales figures, that they want to format for the end > user's > > locale. In order to do this with numberToString, they have to manage > async > > call backs for every request. Doable with deferreds, but not easy. > > > > I noticed this past week that part of the API describes getting back the > > pattern for formatting. For example: > > > > > http://docs.phonegap.com/en/2.5.0/cordova_globalization_globalization.md.ht > > ml#globalization.getNumberPattern > > > > > > So my immediate thought was - cool - I could use this and then apply the > > formats to numbers in a simpler sync process. But it isn't documented how > > one actually *uses* these patterns. I'm thinking it may be obvious (hence > > the lack of documentation), but if anyone could give me a hand to > > understanding it I'd greatly appreciate it. > > > > -Raymond Camden > > > >