function registerComponent(name, definition) {
  var NewComponent;
  var proto = {};
  var schema;
  var schemaIsSingleProp;

  // Warning if component is statically registered after the scene.
  if (document.currentScript && document.currentScript !== aframeScript) {
    _scene_scenes_js__WEBPACK_IMPORTED_MODULE_1__["default"].forEach(function checkPosition(sceneEl) {
      // Okay to register component after the scene at runtime.
      if (sceneEl.hasLoaded) {
        return;
      }

      // Check that component is declared before the scene.
      if (document.currentScript.compareDocumentPosition(sceneEl) === Node.DOCUMENT_POSITION_FOLLOWING) {
        return;
      }
      warn('The component `' + name + '` was registered in a <script> tag after the scene. ' + 'Component <script> tags in an HTML file should be declared *before* the scene ' + 'such that the component is available to entities during scene initialization.');

      // For testing.
      if (window.debug) {
        registrationOrderWarnings[name] = true;
      }
    });
  }
  if (upperCaseRegExp.test(name) === true) {
    warn('The component name `' + name + '` contains uppercase characters, but ' + 'HTML will ignore the capitalization of attribute names. ' + 'Change the name to be lowercase: `' + name.toLowerCase() + '`');
  }
  if (name.indexOf('__') !== -1) {
    throw new Error('The component name `' + name + '` is not allowed. ' + 'The sequence __ (double underscore) is reserved to specify an id' + ' for multiple components of the same type');
  }

  // Format definition object to prototype object.
  Object.keys(definition).forEach(function (key) {
    proto[key] = {
      value: definition[key],
      writable: true
    };
  });
  if (components[name]) {
    throw new Error('The component `' + name + '` has been already registered. ' + 'Check that you are not loading two versions of the same component ' + 'or two different components of the same name.');
  }
  NewComponent = function (el, attr, id) {
    Component.call(this, el, attr, id);
  };
  NewComponent.prototype = Object.create(Component.prototype, proto);
  NewComponent.prototype.name = name;
  NewComponent.prototype.isPositionRotationScale = name === 'position' || name === 'rotation' || name === 'scale';
  NewComponent.prototype.constructor = NewComponent;
  NewComponent.prototype.system = _system_js__WEBPACK_IMPORTED_MODULE_2__ && _system_js__WEBPACK_IMPORTED_MODULE_2__.systems[name];
  NewComponent.prototype.play = wrapPlay(NewComponent.prototype.play);
  NewComponent.prototype.pause = wrapPause(NewComponent.prototype.pause);
  schema = _utils_index_js__WEBPACK_IMPORTED_MODULE_3__.extend(processSchema(NewComponent.prototype.schema, NewComponent.prototype.name));
  NewComponent.prototype.isSingleProperty = schemaIsSingleProp = isSingleProp(NewComponent.prototype.schema);
  NewComponent.prototype.isObjectBased = !schemaIsSingleProp || schemaIsSingleProp && (isObject(schema.default) || isObject(parseProperty(undefined, schema)));

  // Create object pool for class of components.
  objectPools[name] = _utils_index_js__WEBPACK_IMPORTED_MODULE_3__.objectPool.createPool();
  components[name] = {
    Component: NewComponent,
    dependencies: NewComponent.prototype.dependencies,
    before: NewComponent.prototype.before,
    after: NewComponent.prototype.after,
    isSingleProperty: NewComponent.prototype.isSingleProperty,
    isObjectBased: NewComponent.prototype.isObjectBased,
    multiple: NewComponent.prototype.multiple,
    sceneOnly: NewComponent.prototype.sceneOnly,
    name: name,
    schema: schema,
    stringify: NewComponent.prototype.stringify
  };

  // Notify all scenes
  for (var i = 0; i < _scene_scenes_js__WEBPACK_IMPORTED_MODULE_1__["default"].length; i++) {
    _scene_scenes_js__WEBPACK_IMPORTED_MODULE_1__["default"][i].emit('componentregistered', {
      name: name
    }, false);
  }
  return NewComponent;
}
Register a component to A-Frame.

@param {string} name - Component name.
@param {object} definition - Component schema and lifecycle method handlers.
@returns {object} Component.