You could devote an entire component to it, in which case it's just [$component, 'serialize']. I'm not suggesting you write anonymous functions all over the place.