0.1.0 • Published 7 years ago

cratez v0.1.0

Weekly downloads
1
License
ISC
Repository
-
Last release
7 years ago

CRATEZ

A box of functionality that communicates with itself, other boxes, and the system's assembly line.

If your project is event driven with streams or whatever, then you have lot's of little messages firing away and functions executing in response. Cratez connects whater data you can imagine as an object of key/value pairs to a broader system's Event Emitter, a database, and it's own local Event Emitter. Just a box of helpful utilities for applications with data on the wire.

Basic Usage

A Crate provides 2 methods:

  • assemble
  • inherit

Assemble

let crate = require('cratez.js').assemble() || require('cratez.js').assemble(initOptionsYouPassIn);

Inherit

let Crate = require('cratez.js').inherit;

class SomeCustomCrate extends Crate {
  constructor(initOpts) {
    super(...initOpts);
      ...stuff goes here
    }
}

pay careful attention to how events are registered, it's a type/fn mapping that points to a method on the extended class ...so MyExtendedWonder.someMethod can map to system events via:

super.registerEvents({someSystemEvent: {type: 'system', fn: this.someMethod}});

MOVING FORWARD

  • the only DB this works with currently is Mongo; I do plan to implement a new DB connection with each release moving forward
  • calling assemble without any initialization options is pretty worthless at this point, it will become more useful as this project develops
  • I built this module for me, so I don't really care if it doesn't help you; however, I do expect it to grow and become more useful to others down the road.
  • go through the code for more usage...I'm not at a level of concern high enough to document heavily