1.0.5 • Published 7 years ago

ember-cli-ambienx v1.0.5

Weekly downloads
-
License
MIT
Repository
-
Last release
7 years ago

ember-cli-ambienx

This README outlines the details of collaborating on this Ember addon.

Installation

  • git clone this repository
  • npm install
  • bower install

Running

Running Tests

  • npm test (Runs ember try:testall to test your addon against multiple Ember versions)
  • ember test
  • ember test --server

Building

  • ember build

For more information on using ember-cli, visit http://ember-cli.com/.


This is Ember addon provides a wrapper for Ambienx.js. Use some background music to give your website or webapp some ambience.

Installation

ember install ember-cli-ambienx
// or
npm install ember-cli-bg-music --save
// or
yarn add ember-cli-bg-music

After installing the Ember-Cli-Ambienx npm package, the addon will automatically install the bower package for Ambienx.js. Before the addon can work, in your ember-cli-build.js file you will have to import Ambienx.js like this:

app.import('bower_components/ambienx/ambienx.js');

Setup

In your Ember app's config/environment.js file, define a property called ambienx. It accepts an object with key/values that correspond to all the options available in Ambienx.js.

For example:

// config/environment.js
ambienx: {
    audioSrc: 'music.mp3',
    audioLoop: true,
    autoplay: false,
    enabledLoseFocus: true
}

Likewise, all Ambienx.js methods are provided via a service called serviceAmbienx. This service by default is injected into all your components. If you want to use the playAudio() method, you can do so like this:

this.get('serviceAmbienx').playAudio();

Alternative Setup

But you also have an option to initialize Ambienx.js outside the environment.js file. All you need to do is access the Ember-Cli-Ambienx service and store the Ambienx.js initialization in the newAmbienx property.

For example you can initialize Ambienx.js in an instance initializer called audio.js:

let serviceAmbienx = appInstance.lookup('service:service-ambienx');

let newAmbienx = new Ambienx({
    audioSrc: 'music.mp3',
    audioLoop: true,
    autoplay: false,
    enabledLoseFocus: true
});

serviceAmbienx.newAmbienx = newAmbienx;
1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago