aframe Entities Listening for Component Changes


Example

We can use the componentchanged event to listen for changes to the entity:

entity.addEventListener('componentchanged', function (evt) {
  if (evt.detail.name === 'position') {
    console.log('Entity has moved from', 
      evt.detail.oldData, 'to', evt.detail.newData, '!');
  }
});