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 68014DEB1 for ; Wed, 16 Jan 2013 15:48:16 +0000 (UTC) Received: (qmail 25845 invoked by uid 500); 16 Jan 2013 15:48:15 -0000 Delivered-To: apmail-cordova-dev-archive@cordova.apache.org Received: (qmail 25566 invoked by uid 500); 16 Jan 2013 15:48:15 -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 25528 invoked by uid 500); 16 Jan 2013 15:48:14 -0000 Delivered-To: apmail-incubator-callback-dev@incubator.apache.org Received: (qmail 25384 invoked by uid 99); 16 Jan 2013 15:48:13 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 16 Jan 2013 15:48:13 +0000 Date: Wed, 16 Jan 2013 15:48:13 +0000 (UTC) From: "Andrew Grieve (JIRA)" To: callback-dev@incubator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (CB-2227) Move mapping of module->symbol into individual plugins MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 Andrew Grieve created CB-2227: --------------------------------- Summary: Move mapping of module->symbol into individual plugins Key: CB-2227 URL: https://issues.apache.org/jira/browse/CB-2227 Project: Apache Cordova Issue Type: Bug Components: CordovaJS Reporter: Andrew Grieve Assignee: Andrew Grieve Priority: Minor Fix For: 2.4.0 Goals: - Change from listing module->symbol mapping within common.js & platform.js, to listing this within the plugins themselves. - Support apps that don't want us to clobber global symbols. aka, allow module->symbol mapping to be turned off - Allow retrieval of clobbered globals - Currently modules save it themselves when they are loaded - This won't work (reliably) for saving references to globals overridden by other modules - This gets in the way of the idea of lazy-loading modules via getters - Support the use of other module loaders - So... don't do crazy things at require() time. Requirements: Plugins must be able to declare dependencies Plugins must be able to delay onDeviceReady() Plugins must be able to run code to initialize Implementation modulemapper.js: clobbers(...) merges(...) defaults(...) mapModules(wnd) getOriginalSymbol('FileSystem') Start-up flow: Parse all modules common-bootstrap: Loads list of modules named "cordova.*/symbols" Run modulemapper.mapModules(window); Loads list of modules named "cordova.*/main" symbols.js files: Will make calls to modulemapper instead of exporting {clobbers:} This make dependencies work by require()ing dependent symbols We want the to be an evaluated .js file instead of something listed in plugin.xml So that it can export based on browser version Implementation Steps 1. - Expose list of registered modules in scripts/require.js so that we can loop over them 2. - Write modulemapper.js (and have unit tests, of course) 3. - Add logic to bootstrap.js that calls into modulemapper create $PLUGIN_NAME/symbols.js files for each plugin within cordova. 4. - Add logic to bootstrap.js that calls into modulemapper 5. - Create main.js files for those that currently have logic in their platform.js files -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira