[
https://issues.apache.org/jira/browse/RIPPLE-87?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
sylvain garden updated RIPPLE-87:
---------------------------------
Description:
My cordova app consists in a "portail" of several apps invoking each other
thanks to html links or window.location=... calls.
I spent days trying to understand why *cordova plugins didn't load in any page
but the first visited page* of my app.
It turned out that _onDeviceReady_ was fired only in the first app page but not
on the subsequent pages (as told in the console actually).
It might be due to this sequence of code in ripple.js:
{code:js}
module.exports = bridge.exec;
module.exports.init = module.exports.init || function() {
cordova.require("cordova/channel").onNativeReady.fire()
}
{code}
I failed to understand if the cordova object should survive between pages
change or not. I guess it doesn't. However the "bridge.exec" object looks like
it survives between page changes, so the closure is setted only once and refers
to a *outdated "cordova" object* within an outdated containing closure.
By removing {{"module.exports.init ||"}} in such sequences, everything works as
expected.
was:
My cordova app consists in a "portail" of apps calling each other with html
links or window.location=... calls.
I spent days trying to understand why cordova plugins didn't load in any page
but the first visited page of my app.
It turned out that onDeviceReady was called only for the first app (as told in
the console actually).
I failed to understand if the cordova object should survive between pages
change or not. I guess it shoud not.
But I found the workaround to my issue at least: there is this sequence of code
in ripple.js:
"
module.exports = bridge.exec;
module.exports.init = module.exports.init || function() {
cordova.require("cordova/channel").onNativeReady.fire()
}
"
According to my understanding, the bridge.exec object does survive between page
changes, so the closure is setted only once and refers to a outdated "cordova"
in an old (and replaced since) outer closure.
I removed "module.exports.init ||" in such sequences and now everything works
as expected.
> Ripple plaforms don't fire deviceReady after page changes in multiple pages
> application
> ---------------------------------------------------------------------------------------
>
> Key: RIPPLE-87
> URL: https://issues.apache.org/jira/browse/RIPPLE-87
> Project: Apache Ripple
> Issue Type: Bug
> Reporter: sylvain garden
> Labels: initialisation
>
> My cordova app consists in a "portail" of several apps invoking each other
> thanks to html links or window.location=... calls.
> I spent days trying to understand why *cordova plugins didn't load in any
> page but the first visited page* of my app.
> It turned out that _onDeviceReady_ was fired only in the first app page but
> not on the subsequent pages (as told in the console actually).
> It might be due to this sequence of code in ripple.js:
> {code:js}
> module.exports = bridge.exec;
> module.exports.init = module.exports.init || function() {
> cordova.require("cordova/channel").onNativeReady.fire()
> }
> {code}
> I failed to understand if the cordova object should survive between pages
> change or not. I guess it doesn't. However the "bridge.exec" object looks
> like it survives between page changes, so the closure is setted only once and
> refers to a *outdated "cordova" object* within an outdated containing closure.
> By removing {{"module.exports.init ||"}} in such sequences, everything works
> as expected.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)