Allow anonymous functions in modelEvents and collectionEvents