(Vue)
| 3981 | /* */ |
| 3982 | |
| 3983 | function initAssetRegisters (Vue) { |
| 3984 | /** |
| 3985 | * Create asset registration methods. |
| 3986 | */ |
| 3987 | config._assetTypes.forEach(function (type) { |
| 3988 | Vue[type] = function ( |
| 3989 | id, |
| 3990 | definition |
| 3991 | ) { |
| 3992 | if (!definition) { |
| 3993 | return this.options[type + 's'][id] |
| 3994 | } else { |
| 3995 | /* istanbul ignore if */ |
| 3996 | if (process.env.NODE_ENV !== 'production') { |
| 3997 | if (type === 'component' && config.isReservedTag(id)) { |
| 3998 | warn( |
| 3999 | 'Do not use built-in or reserved HTML elements as component ' + |
| 4000 | 'id: ' + id |
| 4001 | ); |
| 4002 | } |
| 4003 | } |
| 4004 | if (type === 'component' && isPlainObject(definition)) { |
| 4005 | definition.name = definition.name || id; |
| 4006 | definition = this.options._base.extend(definition); |
| 4007 | } |
| 4008 | if (type === 'directive' && typeof definition === 'function') { |
| 4009 | definition = { bind: definition, update: definition }; |
| 4010 | } |
| 4011 | this.options[type + 's'][id] = definition; |
| 4012 | return definition |
| 4013 | } |
| 4014 | }; |
| 4015 | }); |
| 4016 | } |
| 4017 | |
| 4018 | /* */ |
| 4019 |
no test coverage detected