โ @bridge/notification
Module that allows extensions to create notifications. View Source Code
js
import { ... } from '@bridge/notification'
โก Functions
create
The create
function allows you to create notifications in bridge's notification system. This will show up in the sidebar.
- Signature:
create(config: INotificationConfig)
- Returns:
Notification
js
create(
icon: 'mdi-apple',
message: 'Hello World!',
color: 'blue'
textColor: 'white',
disposeOnMiddleClick: true,
() => {
// Do something...
},
() => {
// Do something...
}
)
createError
The create
function allows you to create a new error notification. This will show up in the sidebar.
- Signature:
createError(error: Error)
- Returns:
IDisposable
js
createError(new Error('Oops, something went wrong :('))
try {
const t = 0
t = 2 // Throws error, can't reassign constant
} catch (error) {
createError(error)
}
๐ Interfaces
INotificationConfig
ts
export interface INotificationConfig {
id?: string
icon?: string
message?: string
color?: string
textColor?: string
disposeOnMiddleClick?: boolean
isVisible?: boolean
onClick?: () => void
onMiddleClick?: () => void
}