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

@eff-custom-plugins/toast

v1.0.4

Published

toast message plugin (angular 14.0.5)

Downloads

10

Readme

Toast

This library was generated with Angular CLI version 14.0.5.

Installation

NPM

npm i @eff-custom-plugins/toast

Usage

Html

<ngx-toast></ngx-toast>

Attributes

Attributes | Description -----------|------------ @Input() closeIconClass: string | Custom class for custom close button.

Toast properties (IToast)

All the properties are optional.

Properties | Description -----------|------------ callback: (toast: IToast) => {} | Callback function to execute on details button click. clickToRoute: string | Set the 'url' to navigate. closableType: ToastTypeEnum | Use this type, if you want to close all by current type. Acceptable types are: INFO, ERROR, WARNING, SUCCESS. closeOnClickDetails: boolean | Set true if you want to close toast on details button click. detailsButtonInline: boolean | Set true if you want the details button be inline. detailsButtonText: string | Text for details button. detailsText: string | Additional details text (will be shown after the message). detailsTextClass: string | Custom class for detailsText. expanded: boolean | Set this property 'true' if you've added optional properties (like 'title', 'detailsText', etc...). hasIcon: boolean | Set true if you want additional icon with your message. You can add your custom icon class with "messageIconClass" property. Defalut icon is loading. id: any | Id for identifying current toast. keepInRouteChange: boolean | Set true if you want to keep the toast after route change. keepSameMessageToasts: boolean | Set true if you want to show more than one toasts at the same time with matching texts. message: string | Toast message. messages: string[] | Toast messages as array, if you've more than one message in array. messageIconClass: string | Add custom class to add icon before message text. (Also you'll need to add hasIcon: true) timeout: number | Toast message showing duration. title: string | Toast message title. type: ToastTypeEnum | One of these types: INFO, ERROR, WARNING, SUCCESS. setCustomTimer: boolean | Set true if you want us to check message's text's length and add toast showing duration according to the message length.

Example and Sample Code

  1. Import 'ToastModule', 'RouterModule' and 'BrowserAnimationsModule' in your app module
import { RouterModule } from "@angular/router";
import { ToastModule } from "@eff-custom-plugins/toast";
import { BrowserAnimationsModule } from "@angular/platform-browser/animations";

@NgModule({
  imports:[
    ..
    ToastModule.forRoot(),
    BrowserAnimationsModule,
    RouterModule.forRoot([])
  ..
  ]
})
  1. Add 'ngx-toast' in your component html
<ngx-toast closeIconClass="my-custom-close-class"></ngx-toast>
  1. Add styles and assets folder in your angular.json
"styles": [
  ..
  "node_modules/@eff-custom-plugins/toast/lib/assets/sass/toast.scss"
  ..
]
  1. Add 'ToastService' in ts
import {ToastService} from "@eff-custom-plugins/toast";

class Demo {
  constructor(private toastService: ToastService) {}
}
  1. ** Call desired function from toastService **
/*Method to listen for onChange event from timesheet*/
private callToasts(): void {
  this.toastService.success('I am a success message!');
  this.toastService.warn('I am a warning message!', {hasIcon: true, id: 'id', timeout: 6000});
  this.toastService.error('I am an error message!', {detailsText: 'Some more info about error', expanded: true});
  this.toastService.info('I am an info message!', {title: 'Info title', expanded: true, timeout: 7000});
  this.toastService.close('id');
  this.toastService.clearAll();
}
  1. You're done. Run your app. cheers!