You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
errMsg=`Function '${message.apiFunc}' is not registered for the iorpc API. Please verify it is properly defined and exposed.`;
280
281
}else{
282
+
if(ignoreCallbackUnavailable)return;
281
283
errMsg=`Callback '${message.apiFunc}' is unavailable. It might have been removed from the waiting queue (maxPendingResponses overflow) or via unbind().`;
Copy file name to clipboardExpand all lines: index.js
+4-2Lines changed: 4 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -75,9 +75,10 @@
75
75
*/
76
76
constcreateIorpc=(sendFn,localApi={},{
77
77
maxPendingResponses =10000,
78
-
allowNestedFunctions =true,
78
+
allowNestedFunctions =false,
79
79
exposeErrors =true,
80
-
injectToThis =true
80
+
injectToThis =true,
81
+
ignoreCallbackUnavailable =false
81
82
})=>{
82
83
constclbs={};
83
84
lettrimWarningFired=false;
@@ -279,6 +280,7 @@
279
280
if(isNaN(message.apiFunc)){
280
281
errMsg=`Function '${message.apiFunc}' is not registered for the iorpc API. Please verify it is properly defined and exposed.`;
281
282
}else{
283
+
if(ignoreCallbackUnavailable)return;
282
284
errMsg=`Callback '${message.apiFunc}' is unavailable. It might have been removed from the waiting queue (maxPendingResponses overflow) or via unbind().`;
-`maxPendingResponses: number = 10000` – Maximum number of unresolved async calls allowed at once. Prevents overflow. It warns once about an error if the limit is exceeded, and deletes the oldest one used.
414
-
-`allowNestedFunctions: boolean = true` – If true, allows functions to be nested in objects or arrays and passed remotely.
416
+
-`allowNestedFunctions: boolean = false` – If true, allows functions to be nested in objects or arrays and passed remotely.
415
417
-`exposeErrors: boolean = true` – If true, forwards full remote error details (like stack traces). If false, replaces them with a generic message.
416
418
-`injectToThis: boolean = true` – If true, replaces this inside called functions with `this.remoteApi`.
419
+
-`ignoreCallbackUnavailable: boolean = false` – If true, errors due to missing callbacks will be ignored. Useful when integrating multiple interfaces over a single channel.
417
420
418
421
`Return` - An object with the following properties:
419
422
-`remote: Object` – A proxy object. Accessing `remote.someFunction()` will trigger a remote call to `someFunction` on the other side.
0 commit comments