🚀 DAY 5 OF LAUNCH WEEK: Introducing Socket Firewall Enterprise.Learn more →
Socket
Book a DemoInstallSign in
Socket

svelte-alerter-component

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

svelte-alerter-component

Easily add custom alerts to your svelte app

latest
Source
npmnpm
Version
1.3.0
Version published
Maintainers
1
Created
Source

svelte-alerter-component

Easily add custom alerts to your svelte app

Usage

Add it to your svelte project:

$ npm i svelte-alerter-component --save

Then, pop it into the component that suites you:

<script>
	import AlerterComponent from 'svelte-alerter-component/component.svelte'; // In some cases you may need the pre compiled svelte: svelte-alerter-component/component
</script>

<Alerter/>

Then, from any page or component you need to, create a new alert:

import Alerter from 'svelte-alerter-component';

new Alerter({
	title: "Like this alert?" // or a svelte component instance
	style: "background: green; border-radius: 1px;"  // Optional.  You can also style alerts with this css selector: .svelte-alerter-component.alert
	time: 3000 // Alert will disapear in 3 seconds.  If no value is specified, the alert will not disapear automaticly
	undo: () => {console.log("Undone!")}  // If a value is specified, an undo button will apear on the alert.  You can style this button with .svelte-alerter-component.undo
}, () => {
	console.log("Alert has been removed!")
})

// or

let myAlert = new Alerter({
	title: "My Alert"
})
myAlert.show();  // Show the alert
myAlert.hide();  // Hide the alert
myAlert.remove();  // Remove the alert

Help

Never be afraid to ask: emooring@protonmail.com or Vehmloewff#0724

Bugs

Found an problem? Submit an issue or ping me on Discord: Vehmloewff#0724.

Keywords

alert

FAQs

Package last updated on 01 Jun 2019

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