You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Andrew Grieve (JIRA)" <ji...@apache.org> on 2013/04/03 02:29:16 UTC

[jira] [Resolved] (CB-2227) Move mapping of module->symbol into individual plugins

     [ https://issues.apache.org/jira/browse/CB-2227?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrew Grieve resolved CB-2227.
-------------------------------

       Resolution: Fixed
    Fix Version/s:     (was: 2.6.0)
                   2.7.0

Last commit: https://git-wip-us.apache.org/repos/asf?p=cordova-js.git;a=commit;h=fe292cab57e2a7880e3b145c5381f3b862d89e23
                
> 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.7.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