Home User Documentation Developer Documentation GitHub

Namespace: dependencyManager

plastic.modules. dependencyManager

Dependency Manager (Singleton)

The Dependency Manager is used to keep track which dependencies are needed to load every plastic element on the page It can (lazy)load those dependencys on demand and manages the according events.



Registry Object that collects all extnal dependencies by name, and ressources

If a module is added that has a new external dependency it can either be added here or be added via setDependency() at runtime. If "test" is given, plastic.js will look if the given global variable exists. If it does, it will not be loaded.


Object of all Ressources that have to be loaded



modules/dependencyManager.js, line 93

Add a dependency that has to be loaded

Name Type Description
dependencyArray Array

Array of dependency names (has to fit with the registry above)


modules/dependencyManager.js, line 117

Fetches all external dependencies asyncronally

Dependencies to load have to be added first via .add(dependencies) Triggers plastic events (loaded-)

Uses https://github.com/rgrove/lazyload/

  • Dependency Caching?


modules/dependencyManager.js, line 83

Gets a dependency Object by name

Name Type Description
dep string


modules/dependencyManager.js, line 159

Checks if Dependency is already loaded. Supports three types of checks:

  • Global Browser Functions
  • jQuery Global Functions
  • jQuery Element Functions
Name Type Description
test string

staticplastic.modules.dependencyManager.setDependency(depName, jsArray, cssArray)

modules/dependencyManager.js, line 64

Sets a new dependency (that isn't registered yet)

Name Type Description
depName string

Dependency Name

jsArray Array optional

Array of JavaScript Files to load (optional)

cssArray Array optional

Array of CSS Files to load (optional)