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 B6F1A18FC6 for ; Fri, 11 Dec 2015 18:35:49 +0000 (UTC) Received: (qmail 61191 invoked by uid 500); 11 Dec 2015 18:35:49 -0000 Delivered-To: apmail-cordova-dev-archive@cordova.apache.org Received: (qmail 61148 invoked by uid 500); 11 Dec 2015 18:35:49 -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 61136 invoked by uid 99); 11 Dec 2015 18:35:49 -0000 Received: from Unknown (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Dec 2015 18:35:49 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id B0BA7C0288 for ; Fri, 11 Dec 2015 18:35:48 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 3.9 X-Spam-Level: *** X-Spam-Status: No, score=3.9 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_REPLY=1, HTML_MESSAGE=3, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=disabled Authentication-Results: spamd4-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-us-east.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id PKvdyLlkuObJ for ; Fri, 11 Dec 2015 18:35:40 +0000 (UTC) Received: from mail-ob0-f178.google.com (mail-ob0-f178.google.com [209.85.214.178]) by mx1-us-east.apache.org (ASF Mail Server at mx1-us-east.apache.org) with ESMTPS id 502BB429DD for ; Fri, 11 Dec 2015 18:35:40 +0000 (UTC) Received: by obbsd4 with SMTP id sd4so39908630obb.0 for ; Fri, 11 Dec 2015 10:35:39 -0800 (PST) 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=jDN1ptpdAjOYUqq2NG4crGSxNQmJXVPWr7xGVXZbccU=; b=pOIpcWhHWMmbyOr1ncRZKHSh6vO5/CwTP3nJ5E+tAWCOpqoKJzyhz4qd2n2/CNisMd WUrRr8hfnxw9NCnZWvs74jJ5W3MnB5JSvYhXzk8/ChA47UQy+4Oh2FgjpXk7+JCpxXBn 8UCTySLkpAtKR6Ejd5W7lA5+BBUCrUwrkTxjI6hZwtd0Vs/qGkAQJE/bCecMpUte536A W802NXwe+EPiRaeyauUTPqc3WaOH49KZvbfYXwVwBCB2G4aaPj3YVEtGwSJU4+D5xNBV 1bxb0aqNgxGFxOKfRyVfXQtf2mbe2382kQ15LAyuXDqaMtDIXcuenfOGAMzOzQYdA+Vd nKzg== MIME-Version: 1.0 X-Received: by 10.182.236.101 with SMTP id ut5mr15006014obc.1.1449858939556; Fri, 11 Dec 2015 10:35:39 -0800 (PST) Received: by 10.76.82.233 with HTTP; Fri, 11 Dec 2015 10:35:39 -0800 (PST) In-Reply-To: References: Date: Fri, 11 Dec 2015 10:35:39 -0800 Message-ID: Subject: Re: [DISCUSS] Loading plugins async or on demand From: Jesse To: "dev@cordova.apache.org" Content-Type: multipart/alternative; boundary=001a11c32286111ac40526a397d1 --001a11c32286111ac40526a397d1 Content-Type: text/plain; charset=UTF-8 Thanks Philipp, We have looked at this in the past. Attempts to 'fix' this will likely fail, and take us in the wrong direction. The goal is browserify as the mainstream way of packaging js, in which case everything is in one file. If you have scientific evidence of an issue, please post it, otherwise let's continue on the path we're on. Cheers, Jesse @purplecabbage risingj.com On Fri, Dec 11, 2015 at 6:25 AM, Carlos Santana wrote: > Can you open a JIRA and explain with more details what is taking most of > the time when loading? > > Are the plugins taking time to load are core cordova plugins (i.e. camera, > device, etc..)? > We try to keep our scripts for clobbers/run/merge very light with no much > work. > > You want to delay the injections and loading of the plugin js scripts? > > If you want to improve load time for your own plugin, maybe you are doing > too much work in the scritps you specify in plugin.xml for merges and > clobbers, run. > What you can do is put the minimal amount of init and work in those > scripts, and later when your plugin is used check if initialize and then do > rest of the init there, including injecting scripts. > > We are planning to use browserfy to concat all the plugin js, and this > should help at least with the loading of the script. > > Another point of is native code for the plugin, you can specify in your > plugin to not load the native code on load of the webview, I believe the > default is false, so it you have true for the custom plugins you are using > maybe this is adding time to your load time > > > example: > > /> > > > > > > > On Thu, Dec 10, 2015 at 9:13 AM Simon MacDonald > > wrote: > > > When you say "fair amount of time" do you have any data on that? Before > > spending time on a solution I'd want to make sure there is actually a > > problem. > > > > What does the delay look like in Chrome/Safari web tools? I'd try running > > an on various devices and seeing what the load times are for the JS on > the > > different platforms. > > > > Simon Mac Donald > > http://hi.im/simonmacdonald > > > > On Thu, Dec 10, 2015 at 7:39 AM, Philipp Kursawe > > > wrote: > > > > > I am new to the list, and somewhat new to Cordova. > > > > > > I wonder why all plugins are loaded before "deviceready" is emitted? I > > > understand for plugins that extend the hosts "navigator" object to > mimic > > > webbrowser functionality like location or sensors you might want to > have > > > them guaranteed to be accessible via global objects on "navigator" once > > the > > > app has been loaded. > > > Was there ever an async/on demand approach considered? > > > Like "cordova.getPlugin("plugin.google.maps").then(maps) {}" > > > > > > I am asking because I would like to reduce the startup time. Loading > the > > > webview already takes a lot of time. Loading all JS takes another fair > > > amount of time all the while cordova is busy loading all plugins. And I > > > don't need any of those plugins functionality right after startup. > > > > > > Happy coding, > > > Phil > > > > > > --001a11c32286111ac40526a397d1--