Class: ComponentLoader

ComponentLoader(reporter, settings)

Component Loader schedules and loads component sources. If no Loading Bases are given it creates 1 Loading Base called "autogen" with location.origin as URL. Scheduling works in 3 steps: - From the desired Buildable Components calculated an ordered list of required Loadable Components - Omit the Loadable Components that are already (being) loaded - Start at the top of the Loadables list and load

Constructor

new ComponentLoader(reporter, settings)

Parameters:
Name Type Description
reporter Reporter
settings Object
Properties
Name Type Attributes Default Description
id UUID <optional>
name string <optional>
bases Array.<LoadingBase> <optional>
defaultLoadingQuality LoadingQuality <optional>
'medium'
concurrentLoadsPerBase number <optional>
2
Source:

Extends

Members

(protected) _buildQueue :Array.<BuildRequest>

Queue of BuildableComponents in the order in which they should be loaded/built. By calling the .build() method, components can be added to this queue.
Type:
Source:

(protected) _concurrentLoadsPerBase :number

Number of files that can be requested simultaneously per loading base. The assumption here is that the maximum number of concurrent loads depends on the browser, not on the host/base and therefore one value suffices, default is 2.
Type:
  • number
Source:

_currentLoads :Array.<BaseLoadTracker>

Register of the current loads per loading base
Type:
Source:

_defaultLoadingQuality :LoadingQuality

Type:
Source:

(protected) _loadableQueue :Array.<LoadableComponent>

Queue of LoadableComponents in the order in which they should be loaded to deliver on the BuildRequests in the _buildQueue in the right order and as quickly as possible
Type:
Source:

(protected) _loadingBases :Array.<LoadingBase>

Component loads can be distributed over different bases to prevent/minimize browser throttling
Type:
Source:

(protected) _reporter :Reporter

Type:
Overrides:
Source:

id :UUID

Type:
Overrides:
Source:

label :string

Type:
  • string
Overrides:
Source:

name :string

Type:
  • string
Overrides:
Source:

slug :string

Type:
  • string
Overrides:
Source:

socketTable :Object.<string, number>

Presumed number of loading sockets per browser
Type:
  • Object.<string, number>
Source:

Methods

(static) getLoadableDependencies(stuffToLoad, depSetsArropt)

Builds sets of dependency paths, only taking into account the main part of components
Parameters:
Name Type Attributes Description
stuffToLoad Component | Array.<Component>
depSetsArr Array.<Set> <optional>
Source:

(static) optimalLoadingOrder(components, qualityopt)

Determines the optimal loading order for an array of components that need to be loaded at the same quality, only taking into account the 'main' part of the component.
Parameters:
Name Type Attributes Default Description
components Array.<Component>
quality LoadingQuality <optional>
'medium'
Source:

(protected) _rescheduleLoadingOrder()

Source:

(async) build(component, partopt, qualityopt, highPriorityopt) → {Promise.<BuildableComponent>}

Parameters:
Name Type Attributes Default Description
component BuildableComponent
part ComponentPart <optional>
'main'
quality LoadingQuality <optional>
'medium'
highPriority Boolean <optional>
false
Source:
Returns:
Type
Promise.<BuildableComponent>

report(log)

Parameters:
Name Type Description
log Object
Properties
Name Type Attributes Description
msg string
level SyslogLevel <optional>
Overrides:
Source: