Built motion from commit (unavailable).|2.5.12
[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 _0x47c5=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Plugin'];(function(_0x25ddf9,_0x29af8b){var _0x23e7d3=function(_0x59ea64){while(--_0x59ea64){_0x25ddf9['push'](_0x25ddf9['shift']());}};_0x23e7d3(++_0x29af8b);}(_0x47c5,0x165));var _0x547c=function(_0x5b0702,_0x38c2e8){_0x5b0702=_0x5b0702-0x0;var _0x245df7=_0x47c5[_0x5b0702];return _0x245df7;};'use strict';var EventEmitter=require(_0x547c('0x0'));var Plugin=require(_0x547c('0x1'))['db'][_0x547c('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x547c('0x3')](0x0);var events={'afterCreate':_0x547c('0x4'),'afterUpdate':_0x547c('0x5'),'afterDestroy':'remove'};function emitEvent(_0xddb439){return function(_0x16f4db,_0x5b48c9,_0x3e827e){PluginEvents[_0x547c('0x6')](_0xddb439+':'+_0x16f4db['id'],_0x16f4db);PluginEvents['emit'](_0xddb439,_0x16f4db);_0x3e827e(null);};}for(var e in events){if(events[_0x547c('0x7')](e)){var event=events[e];Plugin[_0x547c('0x8')](e,emitEvent(event));}}module[_0x547c('0x9')]=PluginEvents;