A component’s members and methods can be accessed through the entity from the .components object. Look up the component from the entity’s map of components, and we’ll have access to the component’s internals. Consider this example component:
AFRAME.registerComponent('foo', {
init: function () {
this.bar = 'baz';
},
qux: function () {
// ...
}
});
Let’s access the bar member and qux method:
var fooComponent = document.querySelector('[foo]').components.foo;
console.log(fooComponent.bar);
fooComponent.qux();