How to Test if a Function Exists in Javascript
February 17, 2010
I’m no Javascript expert and I couldn’t work out why it seemed to be so difficult to test to see if a function existed before I called it. In the end Google provided a better way though it wasn’t the most popular suggestion out there, to me it seems the most sensible way:
if (window.myFunctionName) {
myFunctionName();
}
Where myFunctionName is the function you’re testing for, of course.
Potential Problem with the Grails RichUI Plugin AutoComplete Tag
February 9, 2010
I’ve been using the Grails RichUI plugin and have found a few of the tags it provides to be very useful. The one I’m using the most is the AutoComplete tag which I may well be writing more about in the near future. However, tonight I found a potential issue with the way it creates the YUI data source for the component – it seems it always gives it the same name: ‘autoCompleteDataSource’.