PDA

View Full Version : Suggestion: function(){} replace by Ext.emptyFn



Animal
16 Dec 2008, 12:45 AM
There are three places where no-op implementations of functions are specified as



function(){}


These can be replaced by a reference to the singleton no-op function Ext.emptyFn.


UpdateManager
DisplayField
GridPanel

evant
16 Dec 2008, 12:50 AM
Got it, I'll update these in SVN.

Animal
16 Dec 2008, 12:53 AM
It could be that the other ocurrences could use it too.

Like the default, no-op constructor created by Ext.extend if you do not provide one.

I don't know if I like the idea of a load of classes all sharing a constructor, even if it is null. Perhaps Jack can decide whether that level of byte counting is worth it/safe.

Animal
16 Dec 2008, 12:55 AM
Ah, obviously Ext.extend cannot use it, it must create a new function with a new prototype, that's the whole point!