Built motion from commit 192134f6.|2.6.25
[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 _0x00f0=['hook','exports','events','../../mysqldb','Plugin','setMaxListeners','remove','emit','hasOwnProperty'];(function(_0x16c1ad,_0x2bc8d1){var _0x227b06=function(_0x86bc0c){while(--_0x86bc0c){_0x16c1ad['push'](_0x16c1ad['shift']());}};_0x227b06(++_0x2bc8d1);}(_0x00f0,0xec));var _0x000f=function(_0x48674d,_0x219e4c){_0x48674d=_0x48674d-0x0;var _0x79792d=_0x00f0[_0x48674d];return _0x79792d;};'use strict';var EventEmitter=require(_0x000f('0x0'));var Plugin=require(_0x000f('0x1'))['db'][_0x000f('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x000f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x000f('0x4')};function emitEvent(_0x4c8ce1){return function(_0x3cd8ed,_0x53989d,_0x3a0613){PluginEvents[_0x000f('0x5')](_0x4c8ce1+':'+_0x3cd8ed['id'],_0x3cd8ed);PluginEvents['emit'](_0x4c8ce1,_0x3cd8ed);_0x3a0613(null);};}for(var e in events){if(events[_0x000f('0x6')](e)){var event=events[e];Plugin[_0x000f('0x7')](e,emitEvent(event));}}module[_0x000f('0x8')]=PluginEvents;