Built motion from commit 0900f080.|2.5.45
[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 _0x1224=['../../mysqldb','Plugin','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x38ec30,_0x5c8b03){var _0x4f36b2=function(_0x23f092){while(--_0x23f092){_0x38ec30['push'](_0x38ec30['shift']());}};_0x4f36b2(++_0x5c8b03);}(_0x1224,0x10d));var _0x4122=function(_0x13bd92,_0x4eea2b){_0x13bd92=_0x13bd92-0x0;var _0x4a35c2=_0x1224[_0x13bd92];return _0x4a35c2;};'use strict';var EventEmitter=require(_0x4122('0x0'));var Plugin=require(_0x4122('0x1'))['db'][_0x4122('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x4122('0x3')](0x0);var events={'afterCreate':_0x4122('0x4'),'afterUpdate':_0x4122('0x5'),'afterDestroy':'remove'};function emitEvent(_0x1b3b05){return function(_0x1f1533,_0x2f506b,_0x4d5e5b){PluginEvents[_0x4122('0x6')](_0x1b3b05+':'+_0x1f1533['id'],_0x1f1533);PluginEvents[_0x4122('0x6')](_0x1b3b05,_0x1f1533);_0x4d5e5b(null);};}for(var e in events){if(events[_0x4122('0x7')](e)){var event=events[e];Plugin[_0x4122('0x8')](e,emitEvent(event));}}module[_0x4122('0x9')]=PluginEvents;