Using this.Parameter to pass on changing data to a page doesn’t seem to work at all in any way.
this.Parameter.map(function(param) { return param })
just returns a blank observable
this.Parameter.onValueChanged(module, function(param) { return param }) actually works first time, and then never updates, am I missing something here? What is module?
this.onParameterChanged(function(param) {..}) is deprecated and never properly worked anyway.
What’s going on.
P.S: this.Parameter.onValueChanged is missing from the docs, we’re still on this.onParameterChanged(function(param) {..})
Update: Uploaded file on the dropbox, here are the steps to reproduce:
Click on the Dumbbell on the tab bar
Click the small “+” button and create 2 routines (different names)
Open one of the routines, tap the “+” button to create a new workout
Give it any name and add any exercise then tap “Finish”
Tab the Dumbbell again to return to the routines page, then tap one of the routines, go back and tap the other
Relevant files:
MainView.ux: router is established here
WorkoutsListPage.ux: contains a Navigator for pages within the main PageControl
this.Parameter.map() works fine. However, as always, observables don’t propagate any data until you subscribe to them.
There are three ways to subscribe to something:
Use it somewhere in your module.exports (most recommended way)
Use a .onValueChanged(module, function(value) { ...
Use a .addSubscriber(function() { .. (not recommended unless you have a strategy for when to call .removeSubscriber(), otherwise this will leak)
onValueChanged will be called if the value ever changes for that same page instance. Note that Navigator may choose to recycle the page and create a new one instead of updating the parameter for a given page.
module is a variable that identifies the current module being evaluated. Passing this to onValueChanged ensures that the associated subscription is released along with the module (to avoid subscription leaks).
If you still think there is a bug here, a test case demonstrating this problem would be appreciated.
Can you give me an example of how to properly pass data to a page, where the data could be changing every time that page opens? this.Parameter.map always seems to come up empty.
Edit: After further testing, I believe my project has some bug in particular, I have tried to reproduce it in a small example, but I’ve not had much luck, if anyone can help me with my specific project I’d appreciate it. Thanks
Still waiting on someone to check out my project? I’m convinced this is a bug but I can’t reproduce a minimal test case, if anyone has time, I’d really appreciate it.
I debugged it and found that your particular setup triggers a bug in Fuse when pages are reused. I have a fix on the way that will roll out in an upcoming release.
Meanwhile, a simple work-around is to put Reuse="None" on the page, and it should work like a charm.
Javier: Observables don’t propagate data unless they are subscribed. This is the same in every other reactive framework.
The quickest way would be to simply tt.subscribe(module), but it’s more useful to keep .map()'ing on the observable until you have data to put in module.exports. Everything exported from the module is automatically subscribed.
Javier: if you are still having issues, please post a minimal test case that reproduces your issue, otherwise it’s almost impossible to help you any further than the explanation Anders posted above.
You can use our Dropbox to send us a ZIP with a self contained project (please delete your build folder(s) before archiving, since they are not necessary and only add size to the ZIP-file).
Javier: Your code should work. Of course, console.log won’t print anything because the value is not available synchronously, but the UI should display the text.
Text interpolation, as in placing {tt} in the middle of a <Text Value="..." />, as you are trying to do in your code, is only supported starting in version 0.31.
I did exactly what you posted here, and still can’t pass data from cal.js to notes.js or to even notesview.ux and calling the javascript directly inside the ux.
This is where the {tt} should show up:
This is my call:
I have nothing left to say but, thanks for trying and good luck with the release. Maybe in the future this works for me.
I’ll be using localStorage to be able to pass data around until we make a team decision regarding Fuse framework.
The problem is that you have wrapped your component in a page.
When you say this.Parameter inside Notes the this refers to the component inside, not the page itself. The parameter is sent to the page, not the components inside.