raganwald / allong.es

https://leanpub.com/javascriptallongesix
484 stars 28 forks source link

Working decorator utility fn for wrapping jQuery? #24

Open devinrhode2 opened 5 years ago

devinrhode2 commented 5 years ago

I would love an all-in-one decorator utility function that I can use to wrap jQuery with. I've attempted to write such a utility in my own project devinrhode2/extendFunction.js, but this doesn't successfully wrap jQuery. One guess I have is that jQuery.prototype.init itself has a prototype that I need to also copy over into the decorated function. I have accomplished my goals via a hack, but what I'm seeking is the holy grail all in one decorator utility, which I can use to decorate any javascript function or class (or hybrid function+object+class Frankenstein that is jQuery)

(ps I found this project by searching lodash for "decorator" https://github.com/lodash/lodash/search?q=decorator&type=Issues)