Built motion from commit 67e5df37.|2.0.66
[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 _0xb10b=['hasOwnProperty','hook','events','Plugin','setMaxListeners','save','remove','emit'];(function(_0x270ec4,_0x1c7c96){var _0x5a0e83=function(_0x1454a4){while(--_0x1454a4){_0x270ec4['push'](_0x270ec4['shift']());}};_0x5a0e83(++_0x1c7c96);}(_0xb10b,0x12a));var _0xbb10=function(_0x1a7244,_0x3d99d9){_0x1a7244=_0x1a7244-0x0;var _0x5c4e9f=_0xb10b[_0x1a7244];return _0x5c4e9f;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var Plugin=require('../../mysqldb')['db'][_0xbb10('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){PluginEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);PluginEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];Plugin[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=PluginEvents;