Quantcast
Channel: Comments on: Adding your own callbacks to existing JavaScript functions
Browsing latest articles
Browse All 23 View Live

By: Dave Ward

I’m not sure .bind('.myEvent') would ever do anything useful, would it?

View Article



By: alkos333

Hhmmm hard to think of one. Maybe binding all events of a particular plug-in/framework to be handled by a generic event handler (a logger of some kind of ex.)?

View Article

By: Nordes

This is a good idea about how to use the tmpl with a “before” and “after” trigger.

View Article

By: Muhammad Shoaib

i really appreciate your quality stuff sharing.

View Article

By: Enlaces interesantes de la Semana 9 al 15 de enero de 2012 « Blooglery

[...] Adding your own callbacks to existing JavaScript functions Dave Ward [...]

View Article


By: Robert

Technically, this is not a true callback. While the approach allows you to add flow before and after the function, it’s not a technique for waiting for all the tasks inside the overridden function to...

View Article

By: Sumit

thanks for this! Didn’t need exactly this but I needed the original idea of calling the “oldFunction” after inheriting and altering prototype functions. Thanks, great post!

View Article

By: Akshath

how to set the callback for a function whose name is not known

View Article


By: Dave Ward

I’m not sure I understand the question. Can you show me a code example of what you’re trying to accomplish?

View Article


By: Justin

I tried to do this as a test, and it just seems to cause an endless loop… (As I kinda expected..) function fnTest(v){ console.log('fnTest has ' + v); } var oldTest = fnTest; function fnTest(v){...

View Article

By: Dave Ward

I think you may be running into the way that JavaScript hoists functions defined with the function keyword. Try this instead: var fnTest = function(v) { console.log('fnTest has ' + v); }; var oldTest =...

View Article

By: Umbrae

Just wanted to say thank you for this article. I was trying to add some custom functionality to the content editor pages of MURA CMS and needed to have some script run after an internal function which...

View Article

By: Justin

Yeah actually, I tried it with anonymous functions and it works, but I wanted to do this with existing functions that werent anonymous functions, that are in other plugins or something.

View Article


By: Dave Ward

It’s not that the functions are anonymous. In the end, the var fnName = function() { } declarations will be sitting in the global scope exactly the same as if I’d used function fnName() instead. What...

View Article

By: Dave Ward

Thanks for the kind words, Umbrae. I’m glad I could help.

View Article

Browsing latest articles
Browse All 23 View Live




Latest Images