Closed BarryCarlyon closed 5 years ago
Sure that's how multiple params work. I suppose I could look at the 2nd param type and make some determination on that. You should be fine to pass undefined if you really don't want to compose an empty object.
Usually in nodeJS/javascript you can do
function(callback() {});
function(args, callback() {});
or
function(foo, args, callback() {});
or
function(foo, callback() {});
And function
checks whats passed to it to determine if whats passed is what it expects. So if args is optional, then I just do
function(thing, callback() {});
It's not a problem just the docs are wrong as if I should pass undefined
then it's not optional, as I'm passing undefined
I'd have to check my code and see what I'm using.
I believe I'm primarily using callbacks so it would be a breaking change for me.
Not a problem but it does reduce user choice/flexibility.
Seems good to me!
Description:
This does not work
This does work
I added some weird logging™ to OBSWebSocket.js
And observed that the callback function was attempted to be stringified and passed to OBS over the socket…
You cannot have a callback, and have the arguments be optional.
Versions Used (if applicable):