2.0.1 • Published 5 years ago

brainlet v2.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

Build Status Dependencies Dev-Dependencies

brainlet

Introduction

A low-level simple event engine for JS web apps.

Status

This project is being continually maintained.

Installing

npm i brainlet --save

Basic use

import brainlet from 'brainlet';

// You define the events in your app
const eventNames = {
    SomeEvent: 'SomeEvent'
};

// This is a basic subscriber function
function subscriber(eventName, data) {
    console.log(eventName);
}

// Subscribe the above function
brainlet.subscribe(eventNames.SomeEvent, subscriber);
// Raise an event. This will call all subscribers for the SomeEvent event
brainlet.invokeEvent(eventNames.SomeEvent, { message: 'Hooray' });
// Don't forget to unsubscribe and clean up when you're done
brainlet.unsubscribe(eventNames.SomeEvent, subscriber);
// brainlet also caches event data, which can be retrieved as follows
const someEvent = brainlet.getCachedEventData(eventNames.SomeEvent);

NPM commands

The following can be run with npm run.

  • build-dev: Build the development version of brainlet.
  • build-prod: Build the production version of brainlet.
  • start: Runs webpack in watch mode.
  • test: Runs the tests.
  • lint: Lints the code.
2.0.1

5 years ago

2.0.0

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago