Built motion from commit efa66e19.|2.6.22
[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 _0xcf71=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Plugin','setMaxListeners'];(function(_0x1352fd,_0x166b29){var _0x4de3b6=function(_0x394c0d){while(--_0x394c0d){_0x1352fd['push'](_0x1352fd['shift']());}};_0x4de3b6(++_0x166b29);}(_0xcf71,0xba));var _0x1cf7=function(_0x42ba3b,_0x355441){_0x42ba3b=_0x42ba3b-0x0;var _0x17634b=_0xcf71[_0x42ba3b];return _0x17634b;};'use strict';var EventEmitter=require(_0x1cf7('0x0'));var Plugin=require(_0x1cf7('0x1'))['db'][_0x1cf7('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x1cf7('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1cf7('0x4'),'afterDestroy':_0x1cf7('0x5')};function emitEvent(_0xcc31bf){return function(_0x21307d,_0x11e462,_0x14d074){PluginEvents[_0x1cf7('0x6')](_0xcc31bf+':'+_0x21307d['id'],_0x21307d);PluginEvents[_0x1cf7('0x6')](_0xcc31bf,_0x21307d);_0x14d074(null);};}for(var e in events){if(events[_0x1cf7('0x7')](e)){var event=events[e];Plugin[_0x1cf7('0x8')](e,emitEvent(event));}}module[_0x1cf7('0x9')]=PluginEvents;