Built motion from commit da617fac.|2.6.6
[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 _0xc9ab=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Plugin'];(function(_0x170a79,_0xab81ec){var _0x487c3f=function(_0x3322b9){while(--_0x3322b9){_0x170a79['push'](_0x170a79['shift']());}};_0x487c3f(++_0xab81ec);}(_0xc9ab,0x125));var _0xbc9a=function(_0x293c66,_0x193d9b){_0x293c66=_0x293c66-0x0;var _0x4d2c4c=_0xc9ab[_0x293c66];return _0x4d2c4c;};'use strict';var EventEmitter=require(_0xbc9a('0x0'));var Plugin=require(_0xbc9a('0x1'))['db'][_0xbc9a('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xbc9a('0x3')};function emitEvent(_0x20e8eb){return function(_0x23d40c,_0x33e557,_0x16f84d){PluginEvents[_0xbc9a('0x4')](_0x20e8eb+':'+_0x23d40c['id'],_0x23d40c);PluginEvents[_0xbc9a('0x4')](_0x20e8eb,_0x23d40c);_0x16f84d(null);};}for(var e in events){if(events[_0xbc9a('0x5')](e)){var event=events[e];Plugin[_0xbc9a('0x6')](e,emitEvent(event));}}module[_0xbc9a('0x7')]=PluginEvents;