Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

alert-service

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

alert-service

SweetAlert2 wrapper and conveniency lib

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Alert Service

This is a wrapper lib for SweetAlert2 with optional Angular2 support. It makes most of the boilerplate while makes available to

Install

npm i alert-service -S

If using it in Angular2 you can import the AlertServiceProviderNg2 and add it to the list of providers in your module.

Usage

Available functions

  • successPopup: success + ok button
  • warningConfirm: warning + ok / cancel
  • errorPopup: error + ok button
  • prompt: text prompt
  • promptMultiline: multiline prompt
  • numberPrompt: number prompt

You can use the swal getter to get the original SweetAlert function.

Parameters

Call signature for all functions:

  • successPopup(options: SweetAlertOptions): Promise<void>
  • successPopup(text: string): Promise<void>
  • successPopup(text: string, options: SweetAlertOptions): Promise<void>
  • successPopup(title: string, text: string): Promise<void>
  • successPopup(title: string, text: string, options: SweetAlertOptions): Promise<void>

Return values

All functions are async, e.g. they are then-able or awaitable. Important: The functions won't throw exceptions (so you shouldn't use .catch()), they return false when the original SweetAlert throws an exception.

Return types:

  • The alert-type popups (success, error) return Promise<void>
  • The confirm popup (warning) returns Promise<boolean>, true on confirmation
  • The prompts (text, multiline, number) return Promise<string | false> or Proise<number | false>, false on any ways of cancel.

Keywords

FAQs

Package last updated on 07 Jun 2017

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc