Skip to content

Commit 5887019

Browse files
committed
fix: grower-rsに合わせてjsni_callに修正
1 parent 5d6aefe commit 5887019

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

grower-js/src/jsni.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
import {GrowerRsImports, JSNIFunction} from "./types.ts";
22

33
const FUNCTIONS = "__grower_jsni_functions";
4-
const ENTRY_POINT = "__grower_jsni_call";
4+
5+
// TODO should be __grower_jsni_call
6+
const ENTRY_POINT = "jsni_call";
7+
58
type _Window = Window & typeof global & {
69
[ENTRY_POINT]: (jsFuncNamePtr: number, argsPtr: number, argsCount: number) => Promise<number>;
710
[FUNCTIONS]: Record<string, JSNIFunction>;
@@ -24,6 +27,7 @@ export default class JavaScriptNativeInterface {
2427

2528
(window as _Window)[ENTRY_POINT] = async (jsFuncNamePtr: number, argsPtr: number, argsCount: number): Promise<number> => {
2629
const session = new JSNIFunctionCallingSession(this.imports, this.memory, jsFuncNamePtr, argsPtr, argsCount);
30+
console.log(session);
2731
const value = await session.call();
2832
return value ? session.buildReturnValues(value) : -1;
2933
};
@@ -66,6 +70,7 @@ class JSNIFunctionCallingSession {
6670
}
6771

6872
async call() {
73+
console.log(`JSNI: Calling function ${this.functionName} with args`, this.args, (window as _Window)[FUNCTIONS][this.functionName]);
6974
return (window as _Window)[FUNCTIONS][this.functionName](...this.args);
7075
}
7176

0 commit comments

Comments
 (0)