MCPcopy
hub / github.com/aframevr/aframe / getAttribute

Method getAttribute

src/core/a-entity.js:716–726  ·  view source on GitHub ↗

* If `attr` is a component, returns ALL component data including applied mixins and * defaults. * * If `attr` is not a component, fall back to HTML getAttribute. * * @param {string} attr * @returns {object|string} Object if component, else string.

(attr)

Source from the content-addressed store, hash-verified

714 * @returns {object|string} Object if component, else string.
715 */
716 getAttribute (attr) {
717 // If component, return component data.
718 var component;
719 if (attr === 'position') { return this.object3D.position; }
720 if (attr === 'rotation') { return getRotation(this); }
721 if (attr === 'scale') { return this.object3D.scale; }
722 if (attr === 'visible') { return this.object3D.visible; }
723 component = this.components[attr];
724 if (component) { return component.data; }
725 return window.HTMLElement.prototype.getAttribute.call(this, attr);
726 }
727
728 /**
729 * If `attr` is a component, returns JUST the component data defined on the entity.

Callers 2

mixinUpdateMethod · 0.95
setAttributeMethod · 0.45

Calls 1

getRotationFunction · 0.85

Tested by

no test coverage detected