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 ArticleBy: Nordes
This is a good idea about how to use the tmpl with a “before” and “after” trigger.
View ArticleBy: Enlaces interesantes de la Semana 9 al 15 de enero de 2012 « Blooglery
[...] Adding your own callbacks to existing JavaScript functions Dave Ward [...]
View ArticleBy: 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 ArticleBy: 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 ArticleBy: 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 ArticleBy: 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 ArticleBy: 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 ArticleBy: 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 ArticleBy: 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 ArticleBy: 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
More Pages to Explore .....