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

6px-alert-service

v0.0.1

Published

Alert service for Angular 4+ using 6pixels UI

Downloads

3

Readme

6px Angular Alert Service

A start for Angular modules

Getting started

This provides a alert service for use with Angular 4+ apps using 6px UI. All files you need live in /src.

Note: There is a package.json file inside of the /dist which is needed for publishing.

Once you have cloned the repo. From the root you can run npm run build. This will run scripts to cleanup, ngc, bundle, minify, and copy.

Publish

To publish to npm you set this up, then run npm run npm-to-publish. This uses the package noted above.

Local development

To develop locally you want to do the following:

npm run build

cd dist/

npm link

This creates a symlink to your global node_modules. Then from your working directory:

npm link 6px-alert-service

Once you are linked to your local copy of the module. In your systemjs.config.js file you need to add you mapping.


map: {
  app: 'app',
  // angular bundles
  ...
  '6px-alert-service': 'node_modules/6px-alert-service/bundles/6px-angular-alert-service.umd.js'
}

NOTE: The name of your bundle is created inside your rollup.config.js file. Rollup us used for creating the umd module.

Then add this to your app.module.ts file.


import { SpxAlertServiceModule } from '6px-alert-service';

@NgModule({
  imports: [
    SpxAlertServiceModule
    ...
  ]
})

Add the tag to your root .html file, this displays your alerts.


<spx-alert></spx-alert>

Now you can use this inside your application by importing the service and calling it's methods.


Add an alert:
@params message: string
@params type: string['success', 'fail', 'info']
@params callback: Function
addAlert(message, type, callback);


Remove an alert:
@params index: number
removeAlertByIndex(index);


Clear all:
clearAll();

Example -


import { SpxAlertService } from '6px-alert-service';

export class AppComponent {
  constructor(private spxAlert: SpxAlertService) {}

  createAlert() {
    this.spxAlert.addAlert('Toast Message', 'success', this.callbackMethod);
  }

  callbackMethod() {
    alert('Alert the callback');
  }
}

Live updates locally

When developing, make your changes and then run npm run build. Once this finishes just refresh and your changes should be seen locally.

Credits

This project is basically a stripped down version of angular-async-local-storage by https://github.com/cyrilletuzi. In his blog he explains how to build a decent Angular module: https://medium.com/@cyrilletuzi/how-to-build-and-publish-an-angular-module-7ad19c0b4464#.9y88ipdk7

License

MIT