Return-Path: X-Original-To: apmail-cordova-dev-archive@www.apache.org Delivered-To: apmail-cordova-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A287C10C03 for ; Thu, 12 Dec 2013 23:41:35 +0000 (UTC) Received: (qmail 84114 invoked by uid 500); 12 Dec 2013 23:41:35 -0000 Delivered-To: apmail-cordova-dev-archive@cordova.apache.org Received: (qmail 84084 invoked by uid 500); 12 Dec 2013 23:41:35 -0000 Mailing-List: contact dev-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cordova.apache.org Delivered-To: mailing list dev@cordova.apache.org Received: (qmail 84076 invoked by uid 99); 12 Dec 2013 23:41:35 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Dec 2013 23:41:35 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [208.65.78.88] (HELO smtp-p01.blackberry.com) (208.65.78.88) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Dec 2013 23:41:31 +0000 Received: from xct107cnc.rim.net ([10.65.161.207]) by mhs211cnc.rim.net with ESMTP/TLS/AES128-SHA; 12 Dec 2013 18:41:08 -0500 Received: from XCT110CNC.rim.net (10.65.161.210) by XCT107CNC.rim.net (10.65.161.207) with Microsoft SMTP Server (TLS) id 14.3.158.1; Thu, 12 Dec 2013 18:41:08 -0500 Received: from XMB111CNC.rim.net ([fe80::fcd6:cc6c:9e0b:25bc]) by XCT110CNC.rim.net ([::1]) with mapi id 14.03.0123.003; Thu, 12 Dec 2013 18:41:07 -0500 From: Josh Soref To: Cordova Dev Subject: Re: [Node 101] Part 2: Avoid the Triangle of Doom Thread-Topic: [Node 101] Part 2: Avoid the Triangle of Doom Thread-Index: AQHO94+Flr3VzNrMDkSFPWs6hxz/CJpRODyA Date: Thu, 12 Dec 2013 23:41:07 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US, en-CA Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: Microsoft-MacOutlook/14.3.9.131030 x-originating-ip: [10.65.160.252] Content-ID: <3E389AE24A7FDA4297FE9638D20BA783@rim.com> MIME-Version: 1.0 Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org Brian wrote: >Flatten your async code. New fashion advocates promises, generators, >events, or one of the streams apis. While flattening with promises is great=8A = >The classic method is to write small testable modules (see part 1) and >flatten your tree. > >Turn code that looks like this [1] into this [2]. =8A I can=B9t figure out how your two example blobs relate. For the sake of people trying to learn patterns, can you please ensure that your [1] and [2] are obvious =B3before=B2 and =B3after=B2? >[1] >https://github.com/apache/cordova-js/blob/b75096a1bade9ca6aa0d38a2039fd922 >ad7c1a95/test/runner.js#L99-L136 >[2] >https://github.com/apache/cordova-js/blob/ced04a4ec71f144dd2cd6c2e9392e3b1 >fc725ec1/tasks/lib/test-browser.js --------------------------------------------------------------------- This transmission (including any attachments) may contain confidential info= rmation, privileged material (including material protected by the solicitor= -client or other applicable privileges), or constitute non-public informati= on. Any use of this information by anyone other than the intended recipient= is prohibited. If you have received this transmission in error, please imm= ediately reply to the sender and delete this information from your system. = Use, dissemination, distribution, or reproduction of this transmission by u= nintended recipients is not authorized and may be unlawful.