ce33acd4839e09b026737007cb54006d84170ca7
[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 _0xcfcb=['hook','exports','events','save','update','remove','emit','hasOwnProperty'];(function(_0xd5584e,_0x251c06){var _0xdc594e=function(_0x2b9c26){while(--_0x2b9c26){_0xd5584e['push'](_0xd5584e['shift']());}};_0xdc594e(++_0x251c06);}(_0xcfcb,0x7a));var _0xbcfc=function(_0x1d06a5,_0x4fc577){_0x1d06a5=_0x1d06a5-0x0;var _0xbaab59=_0xcfcb[_0x1d06a5];return _0xbaab59;};'use strict';var EventEmitter=require(_0xbcfc('0x0'));var Plugin=require('../../mysqldb')['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbcfc('0x1'),'afterUpdate':_0xbcfc('0x2'),'afterDestroy':_0xbcfc('0x3')};function emitEvent(_0x16bde0){return function(_0x38bab3,_0x32707d,_0x83687c){PluginEvents[_0xbcfc('0x4')](_0x16bde0+':'+_0x38bab3['id'],_0x38bab3);PluginEvents[_0xbcfc('0x4')](_0x16bde0,_0x38bab3);_0x83687c(null);};}for(var e in events){if(events[_0xbcfc('0x5')](e)){var event=events[e];Plugin[_0xbcfc('0x6')](e,emitEvent(event));}}module[_0xbcfc('0x7')]=PluginEvents;