Class: Package

AJL. Package

{AJL.Package}

new Package(name, assets, params) → {AJL.Package}

Create Package
Parameters:
Name Type Description
name String Name of package
assets Array Array of assets that need load
params Object Configuration object for this package
Properties
Name Type Description
async Boolean Asynchronous loading of package or not
lazy Boolean Lazy loading of package (waiting for window loads)
depend Array Array of Package's names which need to load before load this
scriptTypeAttr String This value write in script tag in type attribute
linkCssTypeAttr String This value write in link tag in type attribute
linkCssRelAttr String This value write in link tag in rel attribute
Source:
Returns:
Type
AJL.Package
Example
new AJL.Package('My Own Package', [
         'foo.js',
         'bar.js',
         'style.css'
     ], {
         async: false,
         lazy: true
     });

Members

assets :Array

Assets of this package
Type:
  • Array
Source:

config :AJL.PackageConfig

Configuration object of this package
Type:
Source:

name :String

Name of package
Type:
  • String
Source:

Methods

getAssets() → {Array}

Get assets from package
Source:
Returns:
Array of asset's URL
Type
Array
Example
myPackage.getAssets();

getConfig() → {AJL.PackageConfig}

Get config object from package
Source:
Returns:
Type
AJL.PackageConfig
Example
myPackage.getConfig();

getName() → {String}

Get name of package
Source:
Returns:
Name of Package
Type
String
Example
myPackage.getName();

load()

Start loading of package
Source:
Example
myPackage.load();

setAssets(assets)

Set new assets for package
Parameters:
Name Type Description
assets Array New array of asset's URL for package
Source:
Example
myPackage.setAssets([
         'new.js',
         'new2.js'
     ]);

setConfig(config)

Set new config object for package
Parameters:
Name Type Description
config AJL.PackageConfig New object of configuration
Source:
Example
myPackage.setConfig(
     new AJL.PackageConfig({
         lazy: true,
         depend: ['mySecondPackageName']
     }));

setName(name)

Set new name for package
Parameters:
Name Type Description
name String New name of package
Source:
Example
myPackage.setName('New name');