const onEvent = new Deno.UnsafeCallback(
{
parameters: ["pointer"],
result: "void",
},
(e) => {
if (e === null) return;
const view = new Deno.UnsafePointerView(e);
const eventType = view.getUint32(); // Is it the right way to do it?
console.log(eventType);
}
);
const lib = Deno.dlopen("./target/debug/mylib.dylib", {
run_event_loop: { parameters: ["function"], result: "void" },
});
lib.symbols.run_event_loop(onEvent.pointer);
lib.close();
const onEvent = new Deno.UnsafeCallback(
{
parameters: ["pointer"],
result: "void",
},
(e) => {
if (e === null) return;
const view = new Deno.UnsafePointerView(e);
const eventType = view.getUint32(); // Is it the right way to do it?
console.log(eventType);
}
);
const lib = Deno.dlopen("./target/debug/mylib.dylib", {
run_event_loop: { parameters: ["function"], result: "void" },
});
lib.symbols.run_event_loop(onEvent.pointer);
lib.close();