Built motion from commit 9d0783e6.|2.6.13
[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 _0xe978=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','Plugin','update','remove'];(function(_0x450274,_0x31a442){var _0x26a500=function(_0x3428b5){while(--_0x3428b5){_0x450274['push'](_0x450274['shift']());}};_0x26a500(++_0x31a442);}(_0xe978,0x70));var _0x8e97=function(_0x56ad64,_0x46654a){_0x56ad64=_0x56ad64-0x0;var _0x7a0f1e=_0xe978[_0x56ad64];return _0x7a0f1e;};'use strict';var EventEmitter=require(_0x8e97('0x0'));var Plugin=require(_0x8e97('0x1'))['db'][_0x8e97('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x8e97('0x3'),'afterDestroy':_0x8e97('0x4')};function emitEvent(_0x16e587){return function(_0x3e3a3a,_0x1e27f7,_0x4f11c9){PluginEvents[_0x8e97('0x5')](_0x16e587+':'+_0x3e3a3a['id'],_0x3e3a3a);PluginEvents[_0x8e97('0x5')](_0x16e587,_0x3e3a3a);_0x4f11c9(null);};}for(var e in events){if(events[_0x8e97('0x6')](e)){var event=events[e];Plugin[_0x8e97('0x7')](e,emitEvent(event));}}module[_0x8e97('0x8')]=PluginEvents;