in lib/Registration.js [26:135]
var Registration = function () {
function Registration(operator) {
_classCallCheck(this, Registration);
/**
* Operator reference
* @type {function}
* @private
*/
this._operator = operator;
/**
* The registration key
* @type {string}
* @private
*/
this._key = null;
/**
* Registration meta data
* @type {object}
* @private
*/
this._meta = {};
}
/**
* The registration operator
* @returns {Function}
*/
_createClass(Registration, [{
key: 'as',
/**
* Set the registration key, must be unique
* @param {string} key - The key
* @returns {Registration}
*/
value: function as(key) {
if (typeof key !== 'string') {
_Logger2.default.error('RHE13', 'Unexpected key type. Expected a string.', key);
return;
}
this._key = key;
return this;
}
/**
* Set the registration default props
* @param {object} props - The default props
* @returns {Registration}
*/
}, {
key: 'withDefaultProps',
value: function withDefaultProps(props) {
this._meta.defaultProps = props;
return this;
}
/**
* Set the habitat options
* @param {object} options - The habitat options
* @param {string} [options.tag] - The tag to use eg 'span'
* @param {string} [options.className] - The habitats class name
* @param {boolean} [options.replaceDisabled] - If true, the original node will be left in the dom
* @returns {Registration}
*/
}, {
key: 'withOptions',
value: function withOptions(options) {
this._meta.options = options;
return this;
}
}, {
key: 'operator',
get: function get() {
return this._operator;
}
/**
* The registration key
* @returns {string|*}
*/
}, {
key: 'key',
get: function get() {
return this._key;
}
/**
* The registration meta data
* @returns {Object}
*/
}, {
key: 'meta',
get: function get() {
return this._meta;
}
}]);
return Registration;
}();