9608f74155f7d234edf72328e74b7bd6edbc6ff6
[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 _0x28f2=['remove','emit','hook','events','../../mysqldb','Plugin','setMaxListeners','save'];(function(_0xd27675,_0x586367){var _0x545393=function(_0xed852c){while(--_0xed852c){_0xd27675['push'](_0xd27675['shift']());}};_0x545393(++_0x586367);}(_0x28f2,0x193));var _0x228f=function(_0x1d850f,_0x42e43f){_0x1d850f=_0x1d850f-0x0;var _0x8d6106=_0x28f2[_0x1d850f];return _0x8d6106;};'use strict';var EventEmitter=require(_0x228f('0x0'));var Plugin=require(_0x228f('0x1'))['db'][_0x228f('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x228f('0x3')](0x0);var events={'afterCreate':_0x228f('0x4'),'afterUpdate':'update','afterDestroy':_0x228f('0x5')};function emitEvent(_0x11c2cd){return function(_0x79ed5f,_0x4303c3,_0x2bb7d7){PluginEvents[_0x228f('0x6')](_0x11c2cd+':'+_0x79ed5f['id'],_0x79ed5f);PluginEvents[_0x228f('0x6')](_0x11c2cd,_0x79ed5f);_0x2bb7d7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x228f('0x7')](e,emitEvent(event));}}module['exports']=PluginEvents;