incubator-callback-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jesse <purplecabb...@gmail.com>
Subject Re: Hack to compass.js to support iOS watchHeadingFilter
Date Tue, 03 Apr 2012 21:29:33 GMT
The closest thing I can find to an online discussion of the topic of json
hash args to exec :
http://groups.google.com/group/phonegap-dev/browse_thread/thread/7f5dac6fd2d69469/296e12c0306468c8?lnk=gst&q=exec#296e12c0306468c8


There were other discussions as well during the work I did for WP7,
although I don't see it immediately. Ultimately, I did not mean to imply
that the wrong choice was made, just stating why I took the approach I did.

Fil, I know your trying to fuck with us.
Bryce, agreed, this would likely break stuff.

Update, since people keep replying before I can finish.
I will worry about patching WP7 and we can deal with consistency issues
between platforms later.


On Tue, Apr 3, 2012 at 2:20 PM, Shazron <shazron@gmail.com> wrote:

> Fil,
> Your decision was the one that makes most sense - no worries,
> cordova-js needed to get done. I'll make the changes needed in Obj-C.
> I don't even remember what we decided regarding exec function
> signature, if at all a decision was made.
>
> On Tue, Apr 3, 2012 at 2:01 PM, Filip Maj <fil@adobe.com> wrote:
> > Link?
> >
> > I didn't go with the array approach just to fuck with you guys, I did it
> > to save overall work (I.e. Changing iOS vs. changing Android + BB). IF we
> > did get to a consensus on exec function signature (in the summer? Before
> > we went to apache? Before cordova-js work began?) then I missed it and I
> > apologize.
> >
> > Bottom line: switching between the two is not a big deal. I will
> volunteer
> > to find/replace the ~100 lines of code per platform, no problem.
> >
> > On 4/3/12 1:53 PM, "Jesse" <purplecabbage@gmail.com> wrote:
> >
> >>There is no parameter array in WP7, which is making things super painful!
> >>btw
> >>All exec calls in WP7 use named json objects.
> >>
> >>ex.
> >>exec(success,error, "File", "truncate", {fileName:this.fileName,
> >>size:size});
> >>
> >>This IS the way all the platform SHOULD behave and was discussed ages
> ago,
> >>like last summer.
> >>
> >>
> >>
> >>On Tue, Apr 3, 2012 at 1:48 PM, Filip Maj <fil@adobe.com> wrote:
> >>
> >>> Hey Becky,
> >>>
> >>> I fixed up the tests from your fork and pushed to my fork:
> >>> https://github.com/filmaj/incubator-cordova-js/tree/watchFilter
> >>>
> >>> Basically, from a black box perspective, if you pass no object (i.e.
> >>> undefined) into the compass methods as options, then you can expect
> >>>exec()
> >>> to call into native with undefined.
> >>>
> >>> I'm not sure if it's "purer" but, to make it consistent with use of
> >>>exec()
> >>> across all of our APIs, we would not use an options object to pass
> >>> parameters into native but split the parameters out as individual
> >>> variables in the parameter array going into exec.
> >>>
> >>> The above not necessary for this revision of compass API, though, as
> iOS
> >>> is the only one grabbing any parameters anyways. For 1.7 I can help
> >>> refactor the iOS implementation to clean this up.
> >>>
> >>> That being said, I would like to refactor/change the parameter-passing
> >>> convention in exec(), and I think passing a single object with named
> >>> parameters is nicer and clearer than an array of values. But that is
> for
> >>> another release :)
> >>>
> >>> On 4/3/12 1:25 PM, "Becky Gibson" <gibson.becky@gmail.com> wrote:
> >>>
> >>> >As discussed on this list,  I added back support for the iOS watch
> >>>compass
> >>> >heading by filter method by "extending" the unified JS
> >>>Compass.watchFilter
> >>> >and getCurrentHeading() methods.   Frankly, I think this is a bit of
a
> >>> >hack
> >>> >but it works.  If the call to watchHeading contains an options.filter
> >>> >parameter and it is > 0, I call getCurrentHeading with that options
> >>>object
> >>> >and do not set up a interval to repeatedly call getCurrentHeading. 
I
> >>>hack
> >>> >a "special" value into the timers array so that when a clearWatch is
> >>> >called, I know to call Compass.stopHeading rather than just clearing
> >>>the
> >>> >interval.
> >>> >
> >>> >The issue is that sometimes getCurrentHeading is called with an
> options
> >>> >object and other times options is undefined.  I don't see any issues
> on
> >>> >iOS
> >>> >calling exec with the undefined options param.  Need someone to verify
> >>> >this
> >>> >on Android.  Also, this breaks the unit tests, and not being familiar
> >>>with
> >>> >Jasmine, wasn't sure how to deal with an "optional" parameter?   So,
> >>>could
> >>> >use some advice on how to handle that.  I could also make it a bit
> more
> >>> >"pure" and only pass the options parameter when it is legitimate or
> >>>pass
> >>> >null with it was not passed in.  Looking for suggestions as to how
> >>>best to
> >>> >fix this and modify the tests to pass before I check in.
> >>> >
> >>> >https://github.com/becka11y/incubator-cordova-js/tree/watchFilter
> >>> >
> >>> >thanks,
> >>> >-becky
> >>>
> >>>
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message