Search code examples
jqueryextjshelperequivalent

jQuery equivalents to ExtJS functions extend(), apply() and namespace()?


ExtJS provides some great helper functions like:

  • Ext.extend()
  • Ext.apply()
  • Ext.namespace()

Are there any equivalents in jQuery? I know I could port all three to jQuery since I like them so much, but maybe I'm missing something that's already there. I would like to avoid mingling with prototypes myself if possible.

Endresult

  • Ext.apply(obj1, obj2) => $.extend(obj1, obj2)
  • Ext.extend(obj1, obj2) => $.extend(obj1.prototype, obj2)
  • Ext.ns(string) => custom implementation

Solution

  • jQuery's extend function is like ExtJS's apply function in that it copies data members from the source to the destination. The others might be already made as plugins, but I don't know of any.