Allow extra parameters in the event dispatcher

As asked by @machty, this is a rebase of crob611 PR (#2214).