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