npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

alertforall

v2.0.1

Published

A lightweight library to create different types of alerts for all devices.

Downloads

18

Readme

AlertforAll

Version: 2.0.1

Warning: it is not compatible with version 1.x.x

Github BUG or INFO

AlertforAll is a very lightweight library compatible with many javascript and typescript frameworks.

Installation

USING NPM:
$ npm install alertforall
USING YARN:
 $ yarn add alertforall

Starting

After installing the module as described above, you need to import it to your project.

import AlertforAll,{Alert,Toast} from 'alertforall'
const AlertforAll = require('alertforall') 

example

here is an example to show an alert with automatic closure

  import {Alert} from 'alertforall'

  Alert.type2({TitleMsg:'This is an Alert from AlertforAll'})

screen type1

or

  import {Alert} from 'alertforall'

  Alert.type2({TitleMsg:'Do you want to save?', Btn_Confirm:'Yes', Btn_Cancel:'No'})

screen type1

You can also call the function directly to perform some configurations
import AlertforAll from 'alertforall'

const setting = {
  isDark:true,
  buttonConfirmColor:'orange',
  buttonCancelColor:'aqua'
}

const Alert= AlertforAll(setting)

Alert.type2({TitleMsg:'Do you want to save?', Btn_Confirm:'Yes', Btn_Cancel:'No'})

Promises for slightly more advanced codes are also accepted.

AlertforAll(setting).type1({TitleMsg:'Do you want to save?', Btn_Confirm:'Yes', Btn_Cancel:'No'})
.then((response)=>{console.log(response)})
.catch((error)=>{console.log(response)})

Promises are currently only available for Alert types, and return boolean values ​​or strings as per type4.

screen type1

Toast

In addition to the Alerts we also show some very useful Toasts for mobile devices

import AlertforAll,{Toast} from 'alertforall'

AlertforAll(Setting).frame2({TitleMsg:'An error occurred, please try again later',Ico:'Error'})

alternative

import AlertforAll,{Toast} from 'alertforall'

Toast.frame2({TitleMsg:'An error occurred, please try again later',Ico:'Error'})

Toasts still don't accept promises

screen frame2

The different forms

| NAME|CALL METHOD|ACCEPTED VALUES|REQUIRED| | ------ | :------: | :------: | ---| | type1() | Alert.type1() or AlertforAll().type1() |TitleMsg:string TextMsg:string Btn_Confirm:string Btn_Cancel:string Btn_Third:string(only android)| TitleMsg: required Btn_Confirm & Btn_Cancel: not necessary, if missing activate the third button Btn_Third:only on android, it activates either as a third button or automatically as a single button. | | type2() | Alert.type2() or AlertforAll().type2() |TitleMsg:string TextMsg:string Btn_Confirm:string Btn_Cancel:string| TitleMsg: required Btn_Confirm & Btn_Cancel: not necessary, if not present the default 3s automatic closing is activated. | type3() | Alert.type3() or AlertforAll().type3() |TitleMsg:string Btn_Cancel:string TextMsg:string Ico: 'Success','Error','Warning','Info','Question'|TitleMsg: required Btn_Cancel: not necessary, if not present the default 3s automatic closing is activated. TextMsg:not necessary Ico:not neccessary, default 'success' | frame1() | Toast.frame1() or AlertforAll().frame1() |TitleMsg:string |TitleMsg: required | frame2() | Toast.frame2() or AlertforAll().frame2() |TitleMsg:string Ico:'Success','Error','Warning','Info' |TitleMsg: required Ico:not neccessary, default 'Success'

The various settings

| NAME SETT|CALL METHOD|ACCEPTED VALUES|DEFAULT| | ------ | :------: | :------: | ---| |delay| type2() type3() frame1() frame2() | Number ms | 3000 |device| type1() | 'ios','android | 'android' |isDark|type1() type2() type3() frame1() frame2() | Boolean | false |position| type2() type3() | 'top','center',bottom' | 'top' |color | type2() type3() frame1() | hex value '#000' |'#eee' or '#333'| |textCancelColor| type2() type2() type3() | hex value '#000'| #fff |textConfirmColor| type2() | hex value '#000'| #fff |buttonConfirmColor| type2() |hex value '#000' |#60b558 |buttonCancelColor| type2() type2() type3() | hex value '#000 |#d86060 |positionHorizontal positionVertical | frame1() frame2() |'start''center''end' | 'center 'end' |fontSize| frame1() frame2() | string px '12px' | '14px' |fontWeight|frame1() frame2()| string number '600' | '500'


const object={
 delay:5000, // number-default 3000(3s)
 isDark:false, // boolean-default false
 position:'top', // 'top''center''bottom'-default 'center' 
 ... 
}

AlertforAll(object).prototype()  // with changes applied

AlertforAll().prototype() // standard without modifications

library created for personal projects but made available for other programmers.

Library written by Giacomo Mattina. First released version 6/29/2024