From 441063dd10ecc9c9b64cd80648f1fcbabe57ab37 Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Wed, 16 May 2018 12:03:39 -0400 Subject: [PATCH] add docs for eventWrapper --- lib/process/eventsWrapper.js | 7 +++++++ lib/process/processWrapper.js | 3 +-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/process/eventsWrapper.js b/lib/process/eventsWrapper.js index 95255413b..de1021585 100644 --- a/lib/process/eventsWrapper.js +++ b/lib/process/eventsWrapper.js @@ -2,6 +2,13 @@ const uuid = require('uuid/v1'); const constants = require('../constants'); 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() { this.subscribedEvents = {}; this.listenToParentProcess(); diff --git a/lib/process/processWrapper.js b/lib/process/processWrapper.js index 6ec77409d..a22f15568 100644 --- a/lib/process/processWrapper.js +++ b/lib/process/processWrapper.js @@ -15,10 +15,9 @@ class ProcessWrapper { /** * 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 - * 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 - * @return {ProcessWrapper} Do not instantiate this alone. Use it to extend */ constructor(_options) { this.interceptLogs();