wcurtis / ember-toastr

Wrapper for Toastr.js notifications

Home Page:http://knownasilya.github.io/ember-toastr/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ember-toastr

A service wrapper for toastr.js with auto injection into routes, components, and controllers.

npm version Build Status Ember Observer Score

Usage

ember install ember-toastr

The toastr service is injected as toast into controllers, routes, and components, so it can be used like so:

this.toast.info('Hello there!');

⚠️ Version 2.0 will probably remove the automatic injection into controllers and components in favor of service injection, and your own automatic injection.

If you want to access it anywhere else, please inject it

toast: inject.service(),

test() {
  // don't forget to use `get`, since injections are computed properties
  var toast = this.get('toast');
  
  toast.info('text', 'title', options);
}

See the toastr.js demo for other possible uses, and the toastr.js documentation for explanation of options.

Configuration

These are the default options:

ENV['ember-toastr'] = {
  injectAs: 'toast',
  toastrOptions: {
    closeButton: true,
    debug: false,
    newestOnTop: true,
    progressBar: true,
    positionClass: 'toast-top-right',
    preventDuplicates: true,
    onclick: null,
    showDuration: '300',
    hideDuration: '1000',
    timeOut: '4000',
    extendedTimeOut: '1000',
    showEasing: 'swing',
    hideEasing: 'linear',
    showMethod: 'fadeIn',
    hideMethod: 'fadeOut'
  }
};

All options in toastrOptions are direct options for toastr.js.

Installation

  • git clone this repository
  • npm install
  • bower install

Running

Running Tests

  • ember test
  • ember test --server

Building

  • ember build

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

About

Wrapper for Toastr.js notifications

http://knownasilya.github.io/ember-toastr/

License:MIT License


Languages

Language:JavaScript 78.6%Language:HTML 21.4%