Skip to content
On this page

โ• @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.

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
}

Released under the GPL-3.0 License.