It would be simpler to just return either the onload function or an object: { onload: function() {} } instead of modifying an input parameter.