import Service from '@ember/service'; import $ from 'jquery' export default Service.extend({ alert(msg) { toastr.success(msg); }, info(msg) { toastr.info(msg); }, warn(msg) { toastr.warning(msg); }, error(msg) { toastr.options.closeButton = true; toastr.error(msg); toastr.options.closeButton = false; }, alert2(msg) { this._show_alert_(msg); }, warn2(msg) { this._show_alert_(msg, '#F6F0F0'); }, _show_alert_(msg, bg) { $([ '
', '
', '

', msg, '

', '
' ].join('')) .prependTo($('body')) .animate({'top': '12px' }, 'slow') .fadeOut(2000, function() { $(this).remove(); }); } });