Skip to content

A collection of reusable and well-tested JavaScript utility libraries designed to simplify and speed up your development workflow. Modular, lightweight, and easy to integrate into any modern web application.

License

Notifications You must be signed in to change notification settings

desiderati/js-libs

Repository files navigation

Desiderati JS Libs License: MIT

A collection of JavaScript/TypeScript libraries for Angular applications.

Overview

JS-Libs is a monorepo containing reusable Angular libraries developed by Felipe Desiderati. These libraries provide various functionalities to enhance Angular applications.

Prerequisites and Repoflow.io Registration

  1. Install Node and NPM. Ensure Node.js and npm are installed on your machine. If not, download and install them from Node.js official website.

  2. Configuring npm for the private repository. Execute this login command:

    npm login --registry https://api.repoflow.io/npm/desiderati/js-libs --auth-type legacy
  3. Publishing artifacts. Navigate to your package directory in the terminal and execute:

    npm publish --registry https://api.repoflow.io/npm/desiderati/js-libs

    This prepares npm to publish packages to your specified private repository.

Libraries

Atmosphere

An Angular service wrapper for the atmosphere.js library, providing WebSocket and long-polling communication capabilities for Angular applications.

Key Features

  • WebSocket communication with automatic fallback to long-polling
  • Reconnection handling
  • Observable-based API for reactive programming
  • Simple message sending interface

Installation

npm install @desiderati/[email protected]

Usage

import {AtmosphereService} from '@desiderati/atmosphere';
import {Notification} from '@desiderati/atmosphere';

@Component({
    // ...
})
export class YourComponent {
    constructor(private atmosphereService: AtmosphereService) {
    }

    connect() {
        this.atmosphereService.connect('https://your-server.com/endpoint')
            .subscribe({
                next: (msg: string) => {
                    console.log('Received message:', msg);
                    // Handle the message
                },
                error: (err: any) => {
                    console.error('Connection error:', err);
                    // Handle the error
                }
            });
    }

    sendMessage() {
        const notification = new Notification('Your client (user) identification', 'Your message');
        this.atmosphereService.sendNotification(notification);
    }
}

For more details, see the Atmosphere Library.

Development

Building All Libraries

To build all libraries in the monorepo:

ng build

Building a Specific Library

To build a specific library (e.g., atmosphere):

ng build atmosphere

Running Tests

To run tests for all libraries:

ng test

To run tests for a specific library:

ng test atmosphere

Publishing

After building a library, you can publish it to npm:

cd dist/atmosphere
npm publish

Author

Felipe Desiderati [email protected] (https://github.com/desiderati)

About

A collection of reusable and well-tested JavaScript utility libraries designed to simplify and speed up your development workflow. Modular, lightweight, and easy to integrate into any modern web application.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published