Built motion from commit 19a84241.|2.5.34
[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 _0x90b5=['exports','events','Plugin','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x1c100b,_0x5e17a0){var _0x2417fe=function(_0x4f5756){while(--_0x4f5756){_0x1c100b['push'](_0x1c100b['shift']());}};_0x2417fe(++_0x5e17a0);}(_0x90b5,0x139));var _0x590b=function(_0x19c788,_0x2cf31d){_0x19c788=_0x19c788-0x0;var _0x364e70=_0x90b5[_0x19c788];return _0x364e70;};'use strict';var EventEmitter=require(_0x590b('0x0'));var Plugin=require('../../mysqldb')['db'][_0x590b('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x590b('0x2')](0x0);var events={'afterCreate':_0x590b('0x3'),'afterUpdate':_0x590b('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4cf794){return function(_0x2318b8,_0x27e96f,_0x582a8e){PluginEvents[_0x590b('0x5')](_0x4cf794+':'+_0x2318b8['id'],_0x2318b8);PluginEvents[_0x590b('0x5')](_0x4cf794,_0x2318b8);_0x582a8e(null);};}for(var e in events){if(events[_0x590b('0x6')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x590b('0x7')]=PluginEvents;