Skip to content

Commit

Permalink
fix(notification): remove window error event listener v6 (#1074)
Browse files Browse the repository at this point in the history
Co-authored-by: wattachai <[email protected]>
  • Loading branch information
kosol-komenek-rft and wattachai-lseg authored Jan 17, 2024
1 parent 742e63e commit e1163fc
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 13 deletions.
3 changes: 0 additions & 3 deletions documents/src/pages/elements/notification.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,6 @@ This element can be used natively, like any other element. Using notifications t
<ef-notification error>Hello Everyone! 👋</ef-notification>
```

## Application Error Notifications
During development, when the application is running on localhost or 127.0.0.1, application errors will be shown as a notification. This is to aid development and highlight any errors that may occur, so that they can be addressed before the application is deployed. These error messages will not be shown when your application is hosted in a non-dev environment.

## Accessibility
::a11y-intro::

Expand Down
10 changes: 0 additions & 10 deletions packages/elements/src/notification/helpers/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ import type { Notification } from '../elements/notification';
import { NotificationTray } from '../elements/notification-tray.js';
import type { TaskOptions } from './types';

// TODO: Add to utils?
const DEV_ENV = /^(localhost|127\.0\.0\.1)$/.test(location.hostname);

const NotificationType = {
INFO: 'INFO',
CONFIRM: 'CONFIRM',
Expand Down Expand Up @@ -136,11 +133,4 @@ const error = (message: string, duration?: number): Notification => {
});
};

if (DEV_ENV) {
// Show application errors, in development mode
window.addEventListener('error', (e: ErrorEvent) => {
error(e.message, 1000);
});
}

export { info, confirm, warn, error };

0 comments on commit e1163fc

Please sign in to comment.