I have a component like tweetEnyo, created with enyo script. And based on its kind, i want to perform some action.
Is there a way to find the kind of a component created in enyo at runtime?
You should be able to access the kind
property at runtime. Here's an example detecting the kinds of items selected:
http://jsfiddle.net/RoySutton/frTFK/
If you need to find it using the debugger, you can use the ID with the global enyo object's $ hash. e.g.:
enyo.$.app_myKind.kind
Not to steal the thunder from an upcoming blog post, but in the Chrome/Firefox web inspector, $0 is the last inspected element. So, enyo.$[$0.id].kind
is the kind of the inspected item.
I did note that App had no kind associated with it in my example. Usure why that is.
Update: App was not declared with a specific kind and will fall back to the default kind for the parent, in this case Control
. You can access that value with .defaultKind
. Additionally you can specify kind using actual references to the kind (e.g. kind: enyo.Button
), so .kind
can't be relied on.
The correct way to get the name is to use .kindName
, which will be the actual kind.