Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions addon/services/notifications.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,19 @@ import Service from '@ember/service';
import { A } from '@ember/array';
import EmberObject, { set } from '@ember/object';
import { later, cancel } from '@ember/runloop';
import config from 'ember-get-config';

const globals = config['ember-cli-notifications'] || {}; // Import app config object
import { getOwner } from '@ember/application';

export default class NotificationsService extends Service {
content = A();

constructor(...args) {
super(...args);

const config = getOwner(this).resolveRegistration('config:environment');

this.globals = config['ember-cli-notifications'] || {}; // Import app config object
}

// Method for adding a notification
addNotification(options) {
// If no message is set, throw an error
Expand All @@ -20,8 +26,9 @@ export default class NotificationsService extends Service {
const notification = EmberObject.create({
message: options.message,
type: options.type || 'info',
autoClear: options.autoClear ?? globals.autoClear ?? false,
clearDuration: options.clearDuration ?? globals.clearDuration ?? 3200,
autoClear: options.autoClear ?? this.globals.autoClear ?? false,
clearDuration:
options.clearDuration ?? this.globals.clearDuration ?? 3200,
onClick: options.onClick,
htmlContent: options.htmlContent || false,
cssClasses: options.cssClasses,
Expand Down Expand Up @@ -123,10 +130,10 @@ export default class NotificationsService extends Service {
}

setDefaultAutoClear(autoClear) {
set(globals, 'autoClear', autoClear);
this.globals.autoClear = autoClear;
}

setDefaultClearDuration(clearDuration) {
set(globals, 'clearDuration', clearDuration);
this.globals.clearDuration = clearDuration;
}
}
1 change: 0 additions & 1 deletion ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ module.exports = function (defaults) {

const { maybeEmbroider } = require('@embroider/test-setup');
return maybeEmbroider(app, {
compatAdapters: new Map([['ember-get-config', null]]),
// Needed for IE11 https://github.com/embroider-build/embroider/issues/731
skipBabel: [
{
Expand Down
Loading