* [misc] add callback handling in zin.js to support string and object callbacks for enhanced functionality.

This commit is contained in:
sunhao
2025-10-09 13:35:37 +08:00
parent a9a1a2dd0d
commit 4614b2c379
+17
View File
@@ -762,6 +762,23 @@
}
}
}
if(data.callback)
{
const callback = data.callback;
if(typeof callback === 'string')
{
const func = $.runJS(callback);
if (typeof func === 'function' && !callback.endsWith(';')) func();
}
else if(typeof callback === 'object')
{
const func = $.runJS(callback.name);
if (typeof func === 'function')
{
func.apply(null, Array.isArray(callback.params) ? callback.params : [callback.params]);
}
}
}
}
},
error: (error, type) =>