Fuse version: Fuse version 1.0.0 (build 13426)
OS: macOS Sierra 10.12.5 (16F73)
Create new Fuse Project from the GUI. In “MainView.ux” add:
<App>
<JavaScript File="MainView.js" />
<WhileTrue Value="{test}">
<Text>Test is true</Text>
</WhileTrue>
<WhileFalse Value="{test}">
<Text>Test is false</Text>
</WhileFalse>
<Button Text="Toggle" Clicked="{toggleTest}" />
</App>
Create “MainView.js” in the root-folder and add:
const Observable = require('FuseJS/Observable');
console.log("MainView.js");
let test = Observable(true);
function toggleTest() {
console.log("clicked");
test.value = !test.value;
}
module.exports = {
test,
toggleTest
}
View preview. Nothing happens when I click the button and when I’m refreshing the preview I get an error like “System.NullReferenceException: Object reference not set to an instance of an object” and the Problems tab in the log window writes:
{test} not found in data context
{toggleTest} not found in data context
Failed to properly reset. Try exiting Duse and restarting.
If I’m changing “MainView.ux” to look like (the same wrapped in a StackPanel):
<App>
<JavaScript File="MainView.js" />
<StackPanel>
<WhileTrue Value="{test}">
<Text>Test is true</Text>
</WhileTrue>
<WhileFalse Value="{test}">
<Text>Test is false</Text>
</WhileFalse>
<Button Text="Toggle" Clicked="{toggleTest}" />
</StackPanel>
</App>
Then verything is fine.
Is this supposed to work or am I missing something basic?