Koromix/koffi

How to convert a js function into a structure?

Opened this issue · 0 comments

// 1. Define the following structures
const cb = lib.func('BJCastCreateControlManagerIntf', 'int', [
        'pointer',
        'int',
        'string',
])
// 2. Define listener object
const listener = {
  onSuccess(res){
    console.log(res)
  },
  onFailed(){
   // ...
  }
}
// 3. How to use cb and pass listener as the first parameter
cb(listener,1,'test')  // ??? listener to struct