Skip to content

Instantly share code, notes, and snippets.

@bolav
Last active November 16, 2015 13:44
Show Gist options
  • Save bolav/13cf030264983a64d7bb to your computer and use it in GitHub Desktop.
Save bolav/13cf030264983a64d7bb to your computer and use it in GitHub Desktop.
Shared javascript example
<App Theme="Basic">
<JavaScript File="value.js" ux:Global="Value" />
<StackPanel>
<Panel1 />
<Panel2 />
</StackPanel>
</App>
<StackPanel ux:Class="Panel1">
<JavaScript>
var val = require('Value');
module.exports = {
tv: val.val,
click: val.increase
}
</JavaScript>
<Text Value="{tv}" />
<Button Text="Increase" Clicked="{click}" />
</StackPanel>
<StackPanel ux:Class="Panel2">
<JavaScript>
var val = require('Value');
module.exports = {
tv: val.val,
click: val.increase
}
</JavaScript>
<Text Value="{tv}" />
<Button Text="Increase" Clicked="{click}" />
</StackPanel>
var Observable = require('FuseJS/Observable');
var val = Observable(1);
function increase() {
val.value = val.value + 1;
}
module.exports = {
val: val,
increase: increase
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment