incubator-callback-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jesse <>
Subject Re: Hack to compass.js to support iOS watchHeadingFilter
Date Tue, 03 Apr 2012 20:53:56 GMT
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 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" <> 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.
> >
> >
> >
> >thanks,
> >-becky

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