Let's say I have a code like the following.
Crafty.c("SomeType",{//do something... });
var obj=Crafty.e("SomeType");
Can anyone tell me whether there is a function to check the type of the object?
Ex:
Crafty.isComponent(obj,"SomeType")==true
or
Crafty.getComponents(obj)=="SomeType"
Ah found out from the Crafty.js file that there is a .has() function to check for a component. :)
/**@
* #.has
* @comp Crafty Core
* @sign public Boolean .has(String component)
* Returns `true` or `false` depending on if the
* entity has the given component.
*
* For better performance, simply use the `.__c` object
* which will be `true` if the entity has the component or
* will not exist (or be `false`).
*/