aframe Components Accessing a Component’s Members and Methods


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 () { = 'baz';
  qux: function () {
    // ...

Let’s access the bar member and qux method:

var fooComponent = document.querySelector('[foo]');