2.0.1 • Published 6 years ago

brainlet v2.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
6 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

6 years ago

2.0.0

6 years ago

1.0.11

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago