Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id BCA83200AEE for ; Tue, 3 May 2016 18:36:15 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id BC39D1609F6; Tue, 3 May 2016 18:36:15 +0200 (CEST) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 20E841609F5 for ; Tue, 3 May 2016 18:36:14 +0200 (CEST) Received: (qmail 36935 invoked by uid 500); 3 May 2016 16:36:13 -0000 Mailing-List: contact issues-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list issues@cordova.apache.org Received: (qmail 36195 invoked by uid 99); 3 May 2016 16:36:13 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 May 2016 16:36:13 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id E22572C1F68 for ; Tue, 3 May 2016 16:36:12 +0000 (UTC) Date: Tue, 3 May 2016 16:36:12 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: issues@cordova.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CB-11194) Improve cordova load time MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Tue, 03 May 2016 16:36:15 -0000 [ https://issues.apache.org/jira/browse/CB-11194?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15269008#comment-15269008 ] ASF GitHub Bot commented on CB-11194: ------------------------------------- Github user jasongin commented on a diff in the pull request: https://github.com/apache/cordova-lib/pull/434#discussion_r61912923 --- Diff: cordova-common/cordova-common.js --- @@ -17,26 +17,40 @@ under the License. */ -exports = module.exports = { - events: require('./src/events'), - superspawn: require('./src/superspawn'), - - ActionStack: require('./src/ActionStack'), - CordovaError: require('./src/CordovaError/CordovaError'), - CordovaLogger: require('./src/CordovaLogger'), - CordovaExternalToolErrorContext: require('./src/CordovaError/CordovaExternalToolErrorContext'), - PlatformJson: require('./src/PlatformJson'), - ConfigParser: require('./src/ConfigParser/ConfigParser.js'), - - PluginInfo: require('./src/PluginInfo/PluginInfo.js'), - PluginInfoProvider: require('./src/PluginInfo/PluginInfoProvider.js'), - - PluginManager: require('./src/PluginManager'), - - ConfigChanges: require('./src/ConfigChanges/ConfigChanges.js'), - ConfigKeeper: require('./src/ConfigChanges/ConfigKeeper.js'), - ConfigFile: require('./src/ConfigChanges/ConfigFile.js'), - mungeUtil: require('./src/ConfigChanges/munge-util.js'), - - xmlHelpers: require('./src/util/xml-helpers') -}; +function addProperty(obj, property, modulePath) { + var val = null; + + // Add properties as getter to delay load the modules on first invocation + Object.defineProperty(obj, property, { + configurable: true, + get: function () { + val = val || require(modulePath); + ob[property] = val; --- End diff -- Also, there should be no need to use the 'val' cache if you are overwriting obj[property]. > Improve cordova load time > ------------------------- > > Key: CB-11194 > URL: https://issues.apache.org/jira/browse/CB-11194 > Project: Apache Cordova > Issue Type: Sub-task > Components: Android, CordovaLib > Reporter: Nikhil Khandelwal > > We can delay load some of our dependencies to improve our load time. -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org For additional commands, e-mail: issues-help@cordova.apache.org