Skip to content
Discussion options

You must be logged in to vote
//data is Int8Array , how do I cast JSObject to Int8Array here

Just (Int8Array) data

but overall it's not the correct way. Try something like

@JSBody(params = {"service"}, script = "window['postEvent'] = service.postEvent;")
 static native void export(Services service);

  public class Services {
    @JSExport
    public void postEvent(JSObject data) {
  
    }
  }

Finally, you can just create a module

public class Services {
  @JSExport
  public static void postEvent(JSObject data) {
    // ...
  }
}

and set Services as a main class (you don't need main method). Instead of main, your WasmGC module will provide postEvent method.

Replies: 5 comments 6 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@konsoletyper
Comment options

@konsoletyper
Comment options

Comment options

You must be logged in to vote
1 reply
@konsoletyper
Comment options

Comment options

You must be logged in to vote
2 replies
@konsoletyper
Comment options

Answer selected by bertung
@bertung
Comment options

Comment options

You must be logged in to vote
1 reply
@konsoletyper
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants