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