Skip to content

Commit

Permalink
fix: bring back options and defaults, remove old docs and files
Browse files Browse the repository at this point in the history
  • Loading branch information
knownasilya committed Oct 11, 2019
1 parent 7b80220 commit 819da51
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 8 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ These are the default options:

```js
ENV['ember-toastr'] = {
injectAs: 'toast',
toastrOptions: {
closeButton: true,
debug: false,
Expand Down
1 change: 1 addition & 0 deletions addon/services/toast.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export default Service.extend({

// Auto remove toasts when hidden
if (window && window.toastr) {
window.toastr.options = this.config.toastrOptions || this.defaultToastrOptions;
window.toastr.options.onHidden = run.bind(this, () => {
let toasts = this.get('toasts');
let notVisible = toasts.filter(item => !item.is(':visible'));
Expand Down
30 changes: 29 additions & 1 deletion app/services/toast.js
Original file line number Diff line number Diff line change
@@ -1 +1,29 @@
export { default } from 'ember-toastr/services/toast';
import ENV from '../config/environment';

const 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'
};
const config = ENV['ember-toastr'] || {
toastrOptions: toastrOptions
};

import Service from 'ember-toastr/services/toast';

export default Service.extend({
defaultToastrOptions: toastrOptions,
config: config
})
6 changes: 0 additions & 6 deletions blueprints/.jshintrc

This file was deleted.

0 comments on commit 819da51

Please sign in to comment.