Home / Function/ initAssetRegisters() — vue Function Reference

initAssetRegisters() — vue Function Reference

Architecture documentation for the initAssetRegisters() function in assets.ts from the vue codebase.

Entity Profile

Dependency Diagram

graph TD
  f7d4ac9d_a5a2_315f_f9da_d2eabb371af0["initAssetRegisters()"]
  1aa88392_154b_6e6d_97dc_8ac29df42778["initGlobalAPI()"]
  1aa88392_154b_6e6d_97dc_8ac29df42778 -->|calls| f7d4ac9d_a5a2_315f_f9da_d2eabb371af0
  style f7d4ac9d_a5a2_315f_f9da_d2eabb371af0 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/core/global-api/assets.ts lines 5–35

export function initAssetRegisters(Vue: GlobalAPI) {
  /**
   * Create asset registration methods.
   */
  ASSET_TYPES.forEach(type => {
    // @ts-expect-error function is not exact same type
    Vue[type] = function (
      id: string,
      definition?: Function | Object
    ): Function | Object | void {
      if (!definition) {
        return this.options[type + 's'][id]
      } else {
        /* istanbul ignore if */
        if (__DEV__ && type === 'component') {
          validateComponentName(id)
        }
        if (type === 'component' && isPlainObject(definition)) {
          // @ts-expect-error
          definition.name = definition.name || id
          definition = this.options._base.extend(definition)
        }
        if (type === 'directive' && isFunction(definition)) {
          definition = { bind: definition, update: definition }
        }
        this.options[type + 's'][id] = definition
        return definition
      }
    }
  })
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does initAssetRegisters() do?
initAssetRegisters() is a function in the vue codebase.
What calls initAssetRegisters()?
initAssetRegisters() is called by 1 function(s): initGlobalAPI.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free