Skip to content

Latest commit

 

History

History
56 lines (38 loc) · 1.22 KB

events.md

File metadata and controls

56 lines (38 loc) · 1.22 KB
layout title description permalink
docs
Event logging
Event logging
/docs/pages/events/

Events

This mechanism allows you to track important events happening in your code. You can also subscribe to a specific event to receive an email every time it occurs.

For example:

  • A new user has registered
  • A new email has been sent
  • A robot has finished its jobs and you want to know what happened

Event Interface

Usage

You first need to install pmx, the prototype is then as simple as that:

pmx.emit(EVENT_NAME, DATA)

EVENT_NAME must be a string. DATA can be an object (an array will not work) or a string.

Example #1: User registration

var pmx = require('pmx');

pmx.emit('user:register', {
  user : 'Alex registered',
  email : 'thorustor@gmail.com'
});

Example #2: Content creation

var pmx = require('pmx');

pmx.emit('content:page:created', 'A new page has been created');

Subscribe to an event by email

To subscribe to an event just click on "Subscribe by mail to this event":

Subscribe Event Interface