Options
All
  • Public
  • Public/Protected
  • All
Menu

@youwol/cdn-client

Index

Functions

fetchBundles

  • fetchBundles(dependencies: {}, executingWindow?: Window): Promise<{}>
  • Parameters

    • dependencies: {}

      mapping libraryName=>version or libraryName=>{version, sideEffects} If sideEffects is provided, it will be called using the executingWindow as argument when the library has been installed.

      • [key: string]: string | { sideEffects: (Window: any) => void; version: string }
    • Optional executingWindow: Window

      the window used to install the dependencies, default to the global window

    Returns Promise<{}>

    Promise resolving to the argument dependencies provided as a mapping libraryName=>{version, sideEffects}

fetchJavascriptAddOn

  • fetchJavascriptAddOn(resources: string | string[], executingWindow?: Window): Promise<string[]>
  • Fetch some javascript 'add-ons' of some libraries.

    Parameters

    • resources: string | string[]

      a resource description or a list of resource description. A resource description is a string of pattern {libraryName}#{version}~{rest-of-path} where:

      • libraryName is the name of the library
      • version is the target version
      • rest-of-path is the partial url from the package's directory to the target CSS
    • Optional executingWindow: Window

    Returns Promise<string[]>

fetchLoadingGraph

  • fetchLoadingGraph(loadingGraph: LoadingGraph, executingWindow?: Window, sideEffects?: {}): Promise<void>
  • Fetch the dependencies as described by a LoadingGraph

    Parameters

    • loadingGraph: LoadingGraph

      loading graph descriptor

    • Optional executingWindow: Window

      the window used to install the dependencies, default to the global window

    • Optional sideEffects: {}

      if sideEffects[libName] exist => execute the associated function after the library has been installed in executingWindow

      • [key: string]: (Window: any) => void
          • (Window: any): void
          • Parameters

            • Window: any

            Returns void

    Returns Promise<void>

fetchStyleSheets

  • fetchStyleSheets(resources: string | string[], renderingWindow?: Window): Promise<HTMLLinkElement[]>
  • Parameters

    • resources: string | string[]

      a resource description or a list of resource description. A resource description is a string of pattern {libraryName}#{version}~{rest-of-path} where:

      • libraryName is the name of the library
      • version is the target version
      • rest-of-path is the partial url from the package's directory to the target CSS

      An example of resource description: "@youwol/fv-widgets#0.0.3~dist/assets/styles/style.youwol.css"

    • Optional renderingWindow: Window

      the window used to install the stylesheets, default to global window

    Returns Promise<HTMLLinkElement[]>

    a Promise on created HTMLLinkElement(s)

getLoadingGraph

  • getLoadingGraph(body: { libraries: {} }): Promise<LoadingGraph>
  • Return the loading graph from a mapping library-name=>version. If dependencies are missings from the provided mapping, latest available version are used

    Parameters

    • body: { libraries: {} }

      libraries is a mapping library-name=>version

      • libraries: {}
        • [key: string]: string

    Returns Promise<LoadingGraph>

    Promise on a LoadingGraph

Generated using TypeDoc