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 DE960DAEF for ; Thu, 5 Jul 2012 23:12:51 +0000 (UTC) Received: (qmail 30254 invoked by uid 500); 5 Jul 2012 23:12:51 -0000 Delivered-To: apmail-incubator-callback-dev-archive@incubator.apache.org Received: (qmail 30228 invoked by uid 500); 5 Jul 2012 23:12:51 -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 30220 invoked by uid 99); 5 Jul 2012 23:12:51 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Jul 2012 23:12:51 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of don.coleman@gmail.com designates 209.85.214.175 as permitted sender) Received: from [209.85.214.175] (HELO mail-ob0-f175.google.com) (209.85.214.175) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Jul 2012 23:12:45 +0000 Received: by obcva7 with SMTP id va7so13813781obc.6 for ; Thu, 05 Jul 2012 16:12:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=tR5yrhr5Z96dCRx7TltNSFPM8+G0ePH2xhO+enbPOUY=; b=TeoQ2ReauPIo16tNf+MhWLYHNRd7NGQv9f99UQyx8MKlFFp5kIidH0P8VXu57XKNGN VbAvuNSI0/izONqB6BiCLWqRssLFHZjwTWaRmGGFo1PlUlbYtWlnAvzoZ/tnWSSGDzqg Ca5QmEIHhY8lDDW/iJwk2qRYijNvpbaiivT7jZ+8D2nd+p0JOnXr8e064nA1n+mbiHa9 Ll65MIGJSQCA17miL1xkz4Wc4Se/1Uqs/nMnCYn5rN+rKW6Z5BZ5Bi8FmTz3KxxdqdQY TC4CEwziTrcxek+nEQn0hx/54Y6Ux09tv94tA8eto95oU/S92VLecmHzgJzHGFzjj6Kk A7zA== MIME-Version: 1.0 Received: by 10.182.98.108 with SMTP id eh12mr22724365obb.6.1341529944568; Thu, 05 Jul 2012 16:12:24 -0700 (PDT) Received: by 10.60.134.142 with HTTP; Thu, 5 Jul 2012 16:12:24 -0700 (PDT) Date: Thu, 5 Jul 2012 19:12:24 -0400 Message-ID: Subject: requiring javascript for plugins From: Don Coleman To: callback-dev@incubator.apache.org Content-Type: text/plain; charset=ISO-8859-1 Is there a new recommended way to include javascript for plugins? Previously I just jammed an object onto navigator or a global variable navigator.toast = new Toasty(); https://github.com/m00sey/Toasty/blob/f9dbf58e11cf4ecf386f70331960d33e87566dd9/assets/www/phonegap-toast.js I've rewritten this plugin's javascript as a module and I'm recommending that the user requires the module in their code with var toast = cordova.require('toast'); https://github.com/don/Toasty/blob/bf61ff3c738cebcd285f82490920cf713ac095aa/assets/www/phonegap-toast.js Is this the recommended way? It works fine, it's just an extra step for the user, and different from using a builtin cordova function like navigator.notification.vibrate. Should I still assign the plugin code to navigator or cordova? Is there a way to have my plugin js required by plugin.xml, cordova.addPlugin or some other function??? Are users to need to require built-in cordova for 2.0+?