|
Project Information
Members
Featured
Downloads
|
A little focused java script library meant to make the first steps in dealing with a dynamically typed language easier. I do not care about the debate whether JS is or is not a language and if it does or does not suck. WE are stuck with it for the time being. So back to ValyJs . After delving into the the JS belly of the beast more intensively in my recent history I noticed that some patters repeat itself over and over again. I saw code like the following checking if a member or a method exists before calling it. function myFunction(){
if(someOtherFunction != undefined)
return someOtherFunction();
}or function myFunction(input){
if(input.name)
// do something with name
if(input.age)
// do something with age
}the most common pattern is that of checking for the existence of a element before executing an action. This is where ValyJs comes in and tries to make your life easier. function onStart(){
valy.executeIfExists({
elementId : "TestP",
func: function(element){
element.innerHTML = valy.about.version;
}
});
}
|