View on GitHub

z-amp-core

Amp.Amp ⇐ AudioComponent

Provides a running instance of ZAmp. This is the primary entry point of the library. Developers using this framework should interact with ZAmp exclusively through this interface.

Kind: static class of Amp
Extends: AudioComponent
Author: Mason Yarrick mason.yarrick@zyrous.com

new Amp()

Create a new Amp. This can be used instead of the static Amp.amp() method, but you’ll need to call initialise() afterwards.

amp.addComponent(component)

Add a new component to this Amp. Although you can call this method yourself for a custom component (for example, one that is not handled by the theme you’re using), this is intended to be called internally.

Kind: instance method of Amp
Access: public

Param Type Description
component AudioComponent The component to add to this Amp.

amp.initialise(selector, themeName) ⇒ Promise.<Amp>

Initialise an Amp. This method applies the theme (generating HTML content) then configures and initialises each registered component.

Kind: instance method of Amp
Returns: Promise.<Amp> - The newly initialised Amp.
Access: public

Param Type Default Description
selector String body The CSS selector that defines the HTML element that ZAmp will render itself within.
themeName String   The name of the theme to apply.

Example

// Attach to a div with ID "player", using the minimal theme.
const amp = new Amp();
amp.initialse("#player", "minimal")
  .then(() => console.log("Amp good to go!"));

amp.findComponent(componentName) ⇒ AudioComponent

Retrieve a component by its unique name.

Kind: instance method of Amp
Returns: AudioComponent - The component with the specified name (if available).
Access: public

Param Type Description
componentName String The name of the component to retrieve.

amp.setStorageProvider(providerName)

Set a new type of storage provider for this component.

Kind: instance method of Amp
Access: public

Param Type Description
providerName String The name of the storage provider to set.

amp.player() ⇒ AudioComponent

Retrieve the player component (if available).

Kind: instance method of Amp
Returns: AudioComponent - The audio player.
Access: public

amp.playlist() ⇒ AudioComponent

Retrieve the playlist component (if available).

Kind: instance method of Amp
Returns: AudioComponent - The playlist.
Access: public

amp.equalizer() ⇒ AudioComponent

Retrieve the equalizer component (if available).

Kind: instance method of Amp
Returns: AudioComponent - The equalizer.
Access: public

amp.theme() ⇒ AudioComponent

Retrieve the theme.

Kind: instance method of Amp
Returns: AudioComponent - The active theme.
Access: public

amp.themeManager() ⇒ ThemeManager

Retrieve the theme manager.

Kind: instance method of Amp
Returns: ThemeManager - The theme manager.
Access: public

Amp.amp(selector, themeName) ⇒ Promise.<Amp>

The static version of initialisation of ZAmp. Call this method to create a new running instance of ZAmp with a theme applied.

Kind: static method of Amp

Param Type Default Description
selector String body The CSS selector that tells ZAmp where to find the parent HTML element that it will fit inside.
themeName String   The name of the theme that ZAmp will use.

Example

// Attach to the body of the DOM using the default theme.
Amp.amp()
  .then(() => console.log("Ready to play!"))