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

@jamilservices/sb-module-notify

v1.0.2

Published

Simply Builder Module - Create, Manage, and Destroy Notifications

Downloads

28

Readme

@jamilservices/sb-module-notify

The @jamilservices/sb-module-notify provides a robust solution for managing event-driven notifications. This module encapsulates the functionality required to create, manage, and destroy notifications, ensuring a clean and maintainable interface for event handling.

SimplyBuilder SimplyBuilder SimplyBuilder - sb-module-notify GitHub License

Features

  • Centralized Event Management: Centralizes the creation and management of event listeners, allowing for systematic handling of cross-component communication.
  • Simplified API: Offers a simple API to subscribe to events, emit events, and clean up listeners with minimal code.
  • Module Integrity: The API is frozen to prevent modifications at runtime, ensuring the reliability and security of the module.

Installation

Install this module using pnpm, npm or yarn:

pnpm

pnpm add @jamilservices/sb-module-notify

yarn

npm install @jamilservices/sb-module-notify

yarn

yarn add @jamilservices/sb-module-notify

[!NOTE] This will add the @jamilservices/sb-module-notify as a development dependency in your project.

ESM Import Module

CDN:

You can use the following CDN links to include the module:

https://cdn.skypack.dev/@jamilservices/sb-module-notify@latest/lib/main.min.js

https://cdn.jsdelivr.net/npm/@jamilservices/sb-module-notify@latest/lib/main.min.js

https://unpkg.com/@jamilservices/sb-module-notify@latest/lib/main.min.js

Usage

Importing the Module

  • from install (pnpm/npm/yarn):
import { NotifyModule } from '@jamilservices/sb-module-notify';
  • from cdn:
import { NotifyModule } from 'https://cdn.jsdelivr.net/npm/@jamilservices/sb-module-notify@latest/lib/main.min.js';

Creating/Retrieving a notification instance

const notify = NotifyModule.instance("myEventName");

Subscribing to an Event

notify.subscribe({
    id: "uniqueListenerId",
    fn: data => console.log("Event data:", data)
});

UnSubscribing to an Event

notify.unsubscribe("uniqueListenerId");

Emitting an Event

notify.emit({ key: "value" });

Destroying All Notifications

NotifyModule.destroy();

API Documentation

instance(name: string): SimplyBuilderNotifyStoreInterface

  • Description: Creates/retrieves and returns a new/existing notification instance associated with the specified event name.
  • Parameters:
    • name: The name of the event channel.

destroy(): void

  • Description: Cleans up and removes all event listeners created through any instance of the notification module.

Contribution Guidelines

Interested in contributing? We welcome your contributions to enhance the backend capabilities of @jamilservices/sb-module-notify.
Please check our Contribution Guidelines for more details.

License

@jamilservices/sb-module-notify is available under the MIT License by @jamilservicos.

  • You are free to modify and reuse the code.
  • The original license must be included with copies of this software.
  • We encourage linking back to this repository if you use a significant portion of the source code.