cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shazron <>
Subject Re: Hack to compass.js to support iOS watchHeadingFilter
Date Tue, 03 Apr 2012 21:20:08 GMT
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 <> 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" <> wrote:
>>There is no parameter array in WP7, which is making things super painful!
>>All exec calls in WP7 use named json objects.
>>exec(success,error, "File", "truncate", {fileName:this.fileName,
>>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 <> wrote:
>>> Hey Becky,
>>> I fixed up the tests from your fork and pushed to my fork:
>>> Basically, from a black box perspective, if you pass no object (i.e.
>>> undefined) into the compass methods as options, then you can expect
>>> to call into native with undefined.
>>> I'm not sure if it's "purer" but, to make it consistent with use of
>>> 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" <> wrote:
>>> >As discussed on this list,  I added back support for the iOS watch
>>> >heading by filter method by "extending" the unified JS
>>> >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
>>> >and do not set up a interval to repeatedly call getCurrentHeading.  I
>>> >a "special" value into the timers array so that when a clearWatch is
>>> >called, I know to call Compass.stopHeading rather than just clearing
>>> >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
>>> >Jasmine, wasn't sure how to deal with an "optional" parameter?   So,
>>> >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
>>> >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.
>>> >
>>> >
>>> >
>>> >thanks,
>>> >-becky

View raw message