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

Function wrapPlay

src/core/component.js:740–752  ·  view source on GitHub ↗

* Wrapper for defined play method. * Play component by adding tick behavior and calling user's play method. * * @param {function} playMethod * @returns {function}

(playMethod)

Source from the content-addressed store, hash-verified

738 * @returns {function}
739 */
740function wrapPlay (playMethod) {
741 return function play () {
742 var sceneEl = this.el.sceneEl;
743 var shouldPlay = this.el.isPlaying && !this.isPlaying;
744 if (!this.initialized || !shouldPlay) { return; }
745 playMethod.call(this);
746 this.isPlaying = true;
747 this.eventsAttach();
748 // Add tick behavior.
749 if (!hasBehavior(this)) { return; }
750 sceneEl.addBehavior(this);
751 };
752}
753
754function isObject (value) {
755 return value && value.constructor === Object && !(value instanceof window.HTMLElement);

Callers 1

registerComponentFunction · 0.85

Calls 2

hasBehaviorFunction · 0.85
addBehaviorMethod · 0.80

Tested by

no test coverage detected