Subject
This package implements the subject/observer pattern in ECMAScript 6.
This implementation differs from classic event emitter implementations because its events are typed and they are not identified using magic strings but their constructor, symbols are used under the hood. This removes errors due to typos or usage of deprecated events.
Usage
"use strict"; const Subject = // create an event typeconst MyEvent = Subject // create a constructor and mixin Subject prototype{ } Object // instantiate a subjectconst subject = // observe subject to notify MyEventsubject // notify observerssubject
Requirement
ECMAScript 6.
Installation
The recommended way to install the package in through npm:
$ npm install olvlvl-subjects --save
Cloning the repository
The package is available on GitHub, its repository can be cloned with the following command line:
$ git clone https://github.com/olvlvl/subject.git
Testing
The test suite is ran with the make test
command.
License
olvlvl-subject is licensed under the New BSD License - See the LICENSE file for details.