You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "ASF subversion and git services (JIRA)" <ji...@apache.org> on 2014/02/24 22:19:20 UTC

[jira] [Commented] (CB-5671) facilitate dynamic loading of cordova plugins

    [ https://issues.apache.org/jira/browse/CB-5671?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13910827#comment-13910827 ] 

ASF subversion and git services commented on CB-5671:
-----------------------------------------------------

Commit 5f811bbf2be9f6b18ee1575ab7fa506866291573 in cordova-js's branch refs/heads/master from [~agrieve]
[ https://git-wip-us.apache.org/repos/asf?p=cordova-js.git;h=5f811bb ]

CB-5671 Don't fail plugin loading if plugin modules are already loaded.

This can happen when a build step concats all your JS.


> facilitate dynamic loading of cordova plugins
> ---------------------------------------------
>
>                 Key: CB-5671
>                 URL: https://issues.apache.org/jira/browse/CB-5671
>             Project: Apache Cordova
>          Issue Type: Improvement
>          Components: CordovaJS
>    Affects Versions: 3.2.0
>         Environment: any
>            Reporter: Jon Whitlock
>            Assignee: Andrew Grieve
>              Labels: javascript
>
> Problem: Cordova expects resources to be loaded off the device filesystem.
> 1) On iOS this is very risky due to the turnaround time pushing hotfixes through the App store.
> 2) In complex JS applications one needs to use a loader like require.js to manage async loading (especially on mobile) & module dependancy management (as cordova does internally).
> 3) When integrating with many 3rd-party services like auth/"social login" one needs to have a public-facing page to call back to.
> Use case: We have a bunch of prereqs before cordova.js loads, so we have to load cordova.js using require.js.  However to show localised error messages we need the preferred language from the device to know which language to show messaging in, so we need cordova loaded as part of auth prerequisites.
> Problematic Assumptions:
> a) findCordovaPath() assumes a script tag in the document loaded cordova.js -- not the case with require.js or similar.
> b) injectPluginScript() assumes that cordova_plugins.js is in the same dir as cordova.js
> So using plugins & dynamically loading Cordova is terminal, unless I hack findCordovaPath() to return (in our case) the path where cordova.js is to be found -- which is defined in a JS configuration file.
> I think it would be more robust to define the location of those file(s) in a config file somewhere -- which could also facilitate dynamic loading of cordova.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)