Return-Path: X-Original-To: apmail-incubator-callback-dev-archive@minotaur.apache.org Delivered-To: apmail-incubator-callback-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id EF5F890A5 for ; Tue, 3 Apr 2012 21:30:01 +0000 (UTC) Received: (qmail 4279 invoked by uid 500); 3 Apr 2012 21:30:01 -0000 Delivered-To: apmail-incubator-callback-dev-archive@incubator.apache.org Received: (qmail 4241 invoked by uid 500); 3 Apr 2012 21:30:01 -0000 Mailing-List: contact callback-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: callback-dev@incubator.apache.org Delivered-To: mailing list callback-dev@incubator.apache.org Received: (qmail 4227 invoked by uid 99); 3 Apr 2012 21:30:01 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 Apr 2012 21:30:01 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of purplecabbage@gmail.com designates 209.85.212.47 as permitted sender) Received: from [209.85.212.47] (HELO mail-vb0-f47.google.com) (209.85.212.47) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 Apr 2012 21:29:54 +0000 Received: by vbbfr13 with SMTP id fr13so142565vbb.6 for ; Tue, 03 Apr 2012 14:29:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=LArd9Xy+Rk7hVI/STQAWH5HqO4ZDDh0Fy7XI33MFJwY=; b=OvKgokqccrd+h1lIYKj2KIFgEGj8OJlF/y4NaH0NtW7GK1if3KxOIaKbSKysCDVIuK uSzSx+w+IicmDub3LOdQ+jvhDKPAHZim+7y+JpYH9VOaojNq7qpNw2RW/p/oLXKnW+Nd Aeze41rWdOG2nV3vdhQZlLHoaar4nejQnzmf0/IpiEGBpNkLh7UFFsroLV8Xtbw5Qilr Q+choxuiL4v8E1imteHxobCNxXAaFnUZq3StgCANUt+m4bW2Uy1OCHqz5u7+nl8Xv5dP rcw9g1vX2ylGFSzd/hU9KBK8uEsXliNsAPYn1uTEKitTDaRJQJ8aVrp0z0nP3ekcgud4 PHeg== MIME-Version: 1.0 Received: by 10.52.22.8 with SMTP id z8mr5670186vde.5.1333488573439; Tue, 03 Apr 2012 14:29:33 -0700 (PDT) Received: by 10.220.149.203 with HTTP; Tue, 3 Apr 2012 14:29:33 -0700 (PDT) In-Reply-To: References: Date: Tue, 3 Apr 2012 14:29:33 -0700 Message-ID: Subject: Re: Hack to compass.js to support iOS watchHeadingFilter From: Jesse To: callback-dev@incubator.apache.org Content-Type: multipart/alternative; boundary=20cf3071d0c4bb5f5f04bccd00f5 --20cf3071d0c4bb5f5f04bccd00f5 Content-Type: text/plain; charset=ISO-8859-1 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 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 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! > >>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 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" 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 > >>> > >>> > > > --20cf3071d0c4bb5f5f04bccd00f5--