b5387161c8f4600e685e8f98ce06ea85d233341a
[motion2.git] / server / api / plugin / plugin.events.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0xc627=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','Plugin','setMaxListeners'];(function(_0x330905,_0x267d9f){var _0x5c9360=function(_0x21b1a7){while(--_0x21b1a7){_0x330905['push'](_0x330905['shift']());}};_0x5c9360(++_0x267d9f);}(_0xc627,0x14a));var _0x7c62=function(_0x4a08d5,_0x7bdd7e){_0x4a08d5=_0x4a08d5-0x0;var _0x367b50=_0xc627[_0x4a08d5];return _0x367b50;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x7c62('0x0'))['db'][_0x7c62('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x7c62('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7c62('0x3'),'afterDestroy':_0x7c62('0x4')};function emitEvent(_0x2f79e5){return function(_0x313d80,_0x121766,_0x35859a){PluginEvents[_0x7c62('0x5')](_0x2f79e5+':'+_0x313d80['id'],_0x313d80);PluginEvents[_0x7c62('0x5')](_0x2f79e5,_0x313d80);_0x35859a(null);};}for(var e in events){if(events[_0x7c62('0x6')](e)){var event=events[e];Plugin[_0x7c62('0x7')](e,emitEvent(event));}}module[_0x7c62('0x8')]=PluginEvents;