incubator-callback-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shazron <shaz...@gmail.com>
Subject Re: Hack to compass.js to support iOS watchHeadingFilter
Date Tue, 03 Apr 2012 21:20:08 GMT
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
View raw message