I am looking to pass an observable with a subscriber to a component. When the component changes that observable I was hoping that the subscriber would be notified but it doesn’t look like that is happening. Am I going about this the wrong way or is there another way to get the desired effect? I’m basically looking for some type of callback/change notification to any type of property passed into a component. Here is a short demo app showing the problem:
MainView.js
var Observable = require('FuseJS/Observable');
var status = Observable('fail');
status.addSubscriber(watch);
function watch(){
console.log('Watch: ' + status.value);
}
function someFunc(arg){
console.log('Some func called');
};
module.exports = {
status:status,
someFunc: someFunc
};
DropDown.js
var Observable = require('FuseJS/Observable');
var status = this.Status.inner();
var someFunc = this.SomeFunc;
function statusChange(){
console.log('status change ' + JSON.stringify(status));
//no subscribers are on the status observable
console.log('some func: ' + JSON.stringify(someFunc));
//someFunc is null
status.value = 'success';
}
module.exports = {
status: status,
statusChange: statusChange
};
MainView.ux
<App Background="#eee">
<DockPanel>
<JavaScript File="MainView.js" />
<StackPanel>
<DropDown Status="{status}" SomeFunc="{someFunc}"/>
</StackPanel>
</DockPanel>
</App>
DropDown.ux
<Panel ux:Class="DropDown">
<object ux:Property="Status"/>
<object ux:Property="SomeFunc"/>
<JavaScript File="DropDown.js" />
<Panel Clicked="{statusChange}">
<Text Value="{status}"/>
</Panel>
</Panel>