I never knew about Function.length, thanks. Good idea. I think that solution should be good enough, as the second solution still doesn't handle callbacks without a PluginResult object.