Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@plasma-js/hades

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@plasma-js/hades

A standalone event handler and data manager.

  • 0.5.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Hades

A library for data/event handling

Quickstart

Install:

npm install --save @plasma-js/hades

Then:

// const Hades = require('hades').default;
import Hades from 'hades';

const hades = new Hades();

Usage:

Event manager:

const eventName = 'eventExemple';
const eventHandler = function(message) {
  alert(message);
}

// Subscribe
hades.on(eventName, eventHandler);

// Trigger
hades.publish(eventName, 'Trigger message exemple');

Data manager:

const collectionName = 'events';
const collectionFields = {
  name: 'string|required',
  location: 'string|required',
  tickets: [
    {
      lote: 'integer|required',
      price: 'float|required',
      avaiable: 'integer|required'
    }
  ]
};

const dataExemple = {
  name: 'Lollapalooza',
  location: 'Indie Land',
  tickets: [
    {
      lote: 1,
      price: 600.00,
      avaiable: 600
    },
    {
      lote: 2,
      price: 700.00,
      avaiable: 1000
    }
  ]
};

// Collection register
hades.collections.new(collectionName, collectionFields);

// Validate a entry before register a new line collection
let validEntry = await hades.collections.events.validate(dataExemple);

Tips:

You can import the data managing only (Collections), like in the exemple bellow:

// const Collections = require('hades').Collections;
import { Collections } from 'hades'; // Collections data class

Or only the pubsub class:

// const Events = require('hades').Events;
import { Events } from 'hades'; // Events data class

Keywords

FAQs

Package last updated on 20 Aug 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc