(Vue)
| 5203 | /* */ |
| 5204 | |
| 5205 | function initAssetRegisters (Vue) { |
| 5206 | /** |
| 5207 | * Create asset registration methods. |
| 5208 | */ |
| 5209 | ASSET_TYPES.forEach(function (type) { |
| 5210 | Vue[type] = function ( |
| 5211 | id, |
| 5212 | definition |
| 5213 | ) { |
| 5214 | if (!definition) { |
| 5215 | return this.options[type + 's'][id] |
| 5216 | } else { |
| 5217 | /* istanbul ignore if */ |
| 5218 | if (type === 'component') { |
| 5219 | validateComponentName(id); |
| 5220 | } |
| 5221 | if (type === 'component' && isPlainObject(definition)) { |
| 5222 | definition.name = definition.name || id; |
| 5223 | definition = this.options._base.extend(definition); |
| 5224 | } |
| 5225 | if (type === 'directive' && typeof definition === 'function') { |
| 5226 | definition = { bind: definition, update: definition }; |
| 5227 | } |
| 5228 | this.options[type + 's'][id] = definition; |
| 5229 | return definition |
| 5230 | } |
| 5231 | }; |
| 5232 | }); |
| 5233 | } |
| 5234 | |
| 5235 | /* */ |
| 5236 |
no test coverage detected