Built motion from commit 775e2a94.|2.6.3
[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 _0xe08b=['events','Plugin','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xe08b,0x10e));var _0xbe08=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0xe08b[_0x1e3c16];return _0x47a0c9;};'use strict';var EventEmitter=require(_0xbe08('0x0'));var Plugin=require('../../mysqldb')['db'][_0xbe08('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0xbe08('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xbe08('0x3'),'afterDestroy':_0xbe08('0x4')};function emitEvent(_0x27b8f8){return function(_0x469522,_0x41edfb,_0x1ba7e6){PluginEvents[_0xbe08('0x5')](_0x27b8f8+':'+_0x469522['id'],_0x469522);PluginEvents[_0xbe08('0x5')](_0x27b8f8,_0x469522);_0x1ba7e6(null);};}for(var e in events){if(events[_0xbe08('0x6')](e)){var event=events[e];Plugin[_0xbe08('0x7')](e,emitEvent(event));}}module[_0xbe08('0x8')]=PluginEvents;