Built motion from commit c116dc8b.|2.6.30
[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 _0xb1a3=['Plugin','save','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x13f872,_0x19b741){var _0x222abb=function(_0x1c7e98){while(--_0x1c7e98){_0x13f872['push'](_0x13f872['shift']());}};_0x222abb(++_0x19b741);}(_0xb1a3,0x1cc));var _0x3b1a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb1a3[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0x3b1a('0x0'));var Plugin=require(_0x3b1a('0x1'))['db'][_0x3b1a('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3b1a('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x41fe6c){return function(_0x77489e,_0xd2c9e1,_0x3fcfd5){PluginEvents[_0x3b1a('0x4')](_0x41fe6c+':'+_0x77489e['id'],_0x77489e);PluginEvents[_0x3b1a('0x4')](_0x41fe6c,_0x77489e);_0x3fcfd5(null);};}for(var e in events){if(events[_0x3b1a('0x5')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x3b1a('0x6')]=PluginEvents;