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

2014-06-19 Thread Anis Kadri (JIRA)

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

Anis Kadri commented on CB-5671:


CB-6990

> 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
> Attachments: Screen Shot 2014-03-06 at 8.49.27 AM.png
>
>
> 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.2#6252)


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

2014-06-06 Thread Craig Payne (JIRA)

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

Craig Payne commented on CB-5671:
-

Hi Andrew, is there an Open Issue for doing that work (the build-step to concat 
all the plugin JS &
cordova.js)?  I'd like to track it, so I know when I can remove the cordova.js 
you pointed me at a few months ago.


> 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
> Attachments: Screen Shot 2014-03-06 at 8.49.27 AM.png
>
>
> 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.2#6252)


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

2014-03-06 Thread Andrew Grieve (JIRA)

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

Andrew Grieve commented on CB-5671:
---

[~jpw] Config option sounds good. My main question is where should cordova look 
for the config option to be set?

E.g. maybe have a global variable called "cordova.config.cordovaRoot"

E.g. have a a global called CORDOVA_CONFIG.root

Would it be better to allow the injection function to be stubbed out? e.g. 
CORDOVA_CONFIG.loadScript = function(path, callback) { ... }

> 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
> Attachments: Screen Shot 2014-03-06 at 8.49.27 AM.png
>
>
> 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.2#6252)


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

2014-03-06 Thread Andrew Grieve (JIRA)

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

Andrew Grieve commented on CB-5671:
---

[~speg] My mistake. The fix actually didn't make it into 3.4.0 :(. Relevant 
JIRA is: https://issues.apache.org/jira/browse/CB-6007

> 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
> Attachments: Screen Shot 2014-03-06 at 8.49.27 AM.png
>
>
> 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.2#6252)


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

2014-03-06 Thread Jon Whitlock (JIRA)

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

Jon Whitlock commented on CB-5671:
--

Thanks for the movement on this folks.

agrieve: "do you have any suggestion on how to make this work better with 
require.js? E.g. does it support setting values via the 

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

2014-03-06 Thread Steve H (JIRA)

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

Steve H commented on CB-5671:
-

[~agrieve]  That's weird.  That function looks much better.  I have 3.4.0 for 
sure:
{code}
// Platform: ios
// 3.4.0
{/code}

(You can also see CORDOVA_JS_BUILD_LABEL in the debugger)


> 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
> Attachments: Screen Shot 2014-03-06 at 8.49.27 AM.png
>
>
> 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.2#6252)


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

2014-03-06 Thread Andrew Grieve (JIRA)

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

Andrew Grieve commented on CB-5671:
---

[~speg] What does the say for the cordova.js version at the top of the file (in 
comments)

The latest version of that function should look like:

{quote}
function findCordovaPath() {
var path = null;
var scripts = document.getElementsByTagName('script');
var term = 'cordova.js';
for (var n = scripts.length-1; n>-1; n--) {
var src = scripts[n].src.replace(/\?.*$/, ''); // Strip any query param 
(CB-6007).
if (src.indexOf(term) == (src.length - term.length)) {
path = src.substring(0, src.length - term.length);
break;
}
}
return path;
}
{quote}

> 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
> Attachments: Screen Shot 2014-03-06 at 8.49.27 AM.png
>
>
> 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.2#6252)


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

2014-03-06 Thread Andrew Grieve (JIRA)

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

Andrew Grieve commented on CB-5671:
---

[~speg] - believe that's a bug that has been fixed. Are you seeing this on the 
latest cordova version (3.4.0)?

> 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.2#6252)


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

2014-03-06 Thread Steve H (JIRA)

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

Steve H commented on CB-5671:
-

`findCordovaPath` doesn't seem to be able to handle query parameters. My local 
environment is adding query parameters (for cache busting purposes) and it seem 
that `findCordvaPath` is assuming the length of the string has no query 
parameters.

> 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.2#6252)


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

2014-02-24 Thread ASF subversion and git services (JIRA)

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

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

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

CB-5671 setTimeout to allow concat'ed JS to load before pluginLoader.load()


> 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)


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

2014-02-24 Thread Andrew Grieve (JIRA)

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

Andrew Grieve commented on CB-5671:
---

Made initial progress towards having some flexibility here by at least not 
failing when your JS is concatenated together.

I don't think this addresses your use-case though.

[~jpw] - do you have any suggestion on how to make this work better with 
require.js? E.g. does it support setting values via the 

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

2014-02-24 Thread ASF subversion and git services (JIRA)

[ 
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)


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

2013-12-18 Thread Andrew Grieve (JIRA)

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

Andrew Grieve commented on CB-5671:
---

Totally agree that being more flexible here would be a great thing.

> 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
>  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.4#6159)