mirror of https://github.com/embarklabs/embark.git
add docs for eventWrapper
This commit is contained in:
parent
80c382557f
commit
441063dd10
|
@ -2,6 +2,13 @@ const uuid = require('uuid/v1');
|
||||||
const constants = require('../constants');
|
const constants = require('../constants');
|
||||||
|
|
||||||
class Events {
|
class Events {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs an event wrapper for processes.
|
||||||
|
* Handles sending an event message to the parent process and waiting for its response
|
||||||
|
* No need to create an instance of eventsWrapper for your own process, just extend ProcessWrapper
|
||||||
|
* Then, you an use `this.events.[on|request]` with the usual parameters you would use
|
||||||
|
*/
|
||||||
constructor() {
|
constructor() {
|
||||||
this.subscribedEvents = {};
|
this.subscribedEvents = {};
|
||||||
this.listenToParentProcess();
|
this.listenToParentProcess();
|
||||||
|
|
|
@ -15,10 +15,9 @@ class ProcessWrapper {
|
||||||
/**
|
/**
|
||||||
* Class from which process extend. Should not be instantiated alone.
|
* Class from which process extend. Should not be instantiated alone.
|
||||||
* Manages the log interception so that all console.* get sent back to the parent process
|
* Manages the log interception so that all console.* get sent back to the parent process
|
||||||
* Also creates an Events instance. To use it, just do `this.event.[on|request]`
|
* Also creates an Events instance. To use it, just do `this.events.[on|request]`
|
||||||
*
|
*
|
||||||
* @param {Options} _options Nothing for now
|
* @param {Options} _options Nothing for now
|
||||||
* @return {ProcessWrapper} Do not instantiate this alone. Use it to extend
|
|
||||||
*/
|
*/
|
||||||
constructor(_options) {
|
constructor(_options) {
|
||||||
this.interceptLogs();
|
this.interceptLogs();
|
||||||
|
|
Loading…
Reference in New Issue