Help with Foreign Code Module

I’m having problems with my first Foreign Code.

``` { "RootNamespace":"", "Packages": [ "Fuse", "FuseJS" ], "Includes": [ "MainView.ux:UXFile", "", "*" ] } ```
``` 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”)]

public class ToastMsg : NativeModule {

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);;

var Toast = require('ToastMsg'); function msg(){ Toast.Execute(); }
module.exports = {
``` 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…


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