🚀 DAY 5 OF LAUNCH WEEK:Introducing Webhook Events for Alert Changes.Learn more
Socket
Book a DemoInstallSign in
Socket

@n3/browser-messages

Package Overview
Dependencies
Maintainers
11
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@n3/browser-messages

Browser messages for n3 interfaces

latest
npmnpm
Version
1.1.3
Version published
Maintainers
11
Created
Source

@n3/browser-messages

Всплывающие уведомления для приложений на базе @n3/kit.

❗Если используется отдельно от @n3/kit, необходимо подключить тему @n3/css-base

import { theme } from '@n3/css-base/themes/theme-2';
import { setTheme } from '@n3/css-base';

setTheme(theme);

Успешное уведомление

import { successLog } from '@n3/browser-messages';

successLog({
  title: 'Успешно',
  content: 'Действие прошло успешно',
});

Уведомление об ошибке

import { errorLog } from '@n3/browser-messages';

errorLog({
  title: 'Ошибка',
  content: 'Действие прошло с ошибкой',
});

Параметры

НазваниеОписаниеЗначение по умолчанию
titleЗаголовок
contentСодержание
isAutoCloseЗакрытие по таймаутуfalse
timeoutВремя показа до закрытия4500
zIndexz-index fixed-элемента20

Интергация с axios

Выводит ошибку из поля detail или non_field_errors.

import axios from 'axios';
import { axiosErrorLog } from '@n3/browser-messages';

try {
  await axios.post(...);
} catch (e) {
  axiosErrorLog(e);
}

Аргументы:

  • axiosError - обязательный, ошибка axios;
  • message - необязательный, дополнительные параметры вывода сообщения;
  • order - необязательный, порядок, по которому в ответе производится поиск ошибки, по умолчанию ['detail', 'non_field_errors'].

Keywords

vanilla

FAQs

Package last updated on 05 Feb 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts