Function not found in data context

I tried to call a Javascript function with Callback Handler="{someJSFunction}" but the console always says {someJSFunction} not found in data context.
My Code:

<JavaScript>
	console.log("test");
    	function  someJSFunction () {
        		console.log("some function called");
    	}
        module.exports = { someJSFunction: someJSFunction };
</JavaScript>
<Callback Handler="{someJSFunction}"/>

Hopefully someone can help me with this problem.

Could you please post more complete code? Your Callback probably doesn’t live in the context where the JavaScript resides.

Alas, this works just fine for me:

<App>
	<JavaScript>
		function test() {
			console.log("test called");
		}
		module.exports = {
			test: test
		};
	</JavaScript>
	<Panel Alignment="Center" Width="200" Height="56" Color="#18f">
		<Text Value="Click me" Alignment="Center" Color="#fff" />
		<Clicked>
			<Callback Handler="{test}" />
		</Clicked>
	</Panel>
</App>
<Panel HitTestMode="LocalBounds">
	<Grid Columns="auto,1*" Margin="70,0" Alignment="Right">
		<Text ux:Name="header1" Value="Heute" Alignment="CenterRight"/>
	</Grid>
	<Clicked>
		<JavaScript>
			console.log("test");
			function  someJSFunction () {
				console.log("some function called");
			}
		 	module.exports = { someJSFunction: someJSFunction };
		</JavaScript>
		<Callback Handler="{someJSFunction}"/>
		<Set nav.Active="heute" />
	</Clicked>
</Panel>

Why would you put JavaScript inside of Clicked? Don’t do that.

The JavaScript block is instantiated in UX, so if you only have it there while the Clicked trigger is active (which is a very short while, since it’s a pulse trigger), then it’s no wonder it doesn’t work.

Perhaps you should familiarise yourself with MVVM pattern, since that is what you should follow when making Fuse apps.

Thanks for the fast help, it’s working now