Built motion from commit ddca4d0d.|2.5.47
[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 _0x9b69=['hasOwnProperty','hook','exports','events','../../mysqldb','Plugin','update','emit'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x9b69,0xa3));var _0x99b6=function(_0xab2ce8,_0x12d0fa){_0xab2ce8=_0xab2ce8-0x0;var _0x5b04fe=_0x9b69[_0xab2ce8];return _0x5b04fe;};'use strict';var EventEmitter=require(_0x99b6('0x0'));var Plugin=require(_0x99b6('0x1'))['db'][_0x99b6('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x99b6('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2d5904){return function(_0x3a05b4,_0x293e09,_0x4a62c6){PluginEvents[_0x99b6('0x4')](_0x2d5904+':'+_0x3a05b4['id'],_0x3a05b4);PluginEvents['emit'](_0x2d5904,_0x3a05b4);_0x4a62c6(null);};}for(var e in events){if(events[_0x99b6('0x5')](e)){var event=events[e];Plugin[_0x99b6('0x6')](e,emitEvent(event));}}module[_0x99b6('0x7')]=PluginEvents;