Help with Foreign Code Module

I’m having problems with my first Foreign Code.

Toast.unoproj
``` { "RootNamespace":"", "Packages": [ "Fuse", "FuseJS" ], "Includes": [ "MainView.ux:UXFile", "Toast.uno:SourceFile", "*" ] } ```
Toast.uno
``` using Uno; using Uno.UX; using Uno.Collections;

using Fuse;
using Fuse.Scripting;
using Fuse.Triggers.Actions;

using Uno.Compiler.ExportTargetInterop;

[ForeignInclude(Language.Java, “com.fuse.Activity”, “android.content.Context”, “android.content.Intent”, “android.widget.Toast”)]

[UXGlobalModule]
public class ToastMsg : NativeModule {

[Foreign(Language.Java)]
public extern(Android) void Execute()
@{
Context context = Activity.getRootActivity();
CharSequence text = “Hello toast!”;
int duration = Toast.LENGTH_SHORT;
Toast toast = Toast.makeText(context, text, duration);
toast.show();
@}
}


<h5>MainView.ux</h5>
var Toast = require('ToastMsg'); function msg(){ Toast.Execute(); }
module.exports = {
  msg:msg
}
```
Error
``` Error: JavaScript error in MainView.ux line 6: Error message: Uncaught require(): module not found: ToastMsg File name: MainView.ux Line number: 6 Source line: var Toast = require('ToastMsg'); ```

What is wrong with the above code? It is the first time working with Foreign Code…

Hi!

You need to register the method you want to expose to javascript. Please have a look at the docs for Native JS Modules.