Server IP : 185.86.78.101 / Your IP : 216.73.216.124 Web Server : Apache System : Linux 675867-vds-valikoshka1996.gmhost.pp.ua 5.4.0-150-generic #167-Ubuntu SMP Mon May 15 17:35:05 UTC 2023 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /www/wwwroot/mifepriston.org/node_modules/ultron/ |
Upload File : |
'use strict'; var has = Object.prototype.hasOwnProperty; /** * An auto incrementing id which we can use to create "unique" Ultron instances * so we can track the event emitters that are added through the Ultron * interface. * * @type {Number} * @private */ var id = 0; /** * Ultron is high-intelligence robot. It gathers intelligence so it can start improving * upon his rudimentary design. It will learn from your EventEmitting patterns * and exterminate them. * * @constructor * @param {EventEmitter} ee EventEmitter instance we need to wrap. * @api public */ function Ultron(ee) { if (!(this instanceof Ultron)) return new Ultron(ee); this.id = id++; this.ee = ee; } /** * Register a new EventListener for the given event. * * @param {String} event Name of the event. * @param {Functon} fn Callback function. * @param {Mixed} context The context of the function. * @returns {Ultron} * @api public */ Ultron.prototype.on = function on(event, fn, context) { fn.__ultron = this.id; this.ee.on(event, fn, context); return this; }; /** * Add an EventListener that's only called once. * * @param {String} event Name of the event. * @param {Function} fn Callback function. * @param {Mixed} context The context of the function. * @returns {Ultron} * @api public */ Ultron.prototype.once = function once(event, fn, context) { fn.__ultron = this.id; this.ee.once(event, fn, context); return this; }; /** * Remove the listeners we assigned for the given event. * * @returns {Ultron} * @api public */ Ultron.prototype.remove = function remove() { var args = arguments , ee = this.ee , event; // // When no event names are provided we assume that we need to clear all the // events that were assigned through us. // if (args.length === 1 && 'string' === typeof args[0]) { args = args[0].split(/[, ]+/); } else if (!args.length) { if (ee.eventNames) { args = ee.eventNames(); } else if (ee._events) { args = []; for (event in ee._events) { if (has.call(ee._events, event)) args.push(event); } if (Object.getOwnPropertySymbols) { args = args.concat(Object.getOwnPropertySymbols(ee._events)); } } } for (var i = 0; i < args.length; i++) { var listeners = ee.listeners(args[i]); for (var j = 0; j < listeners.length; j++) { event = listeners[j]; // // Once listeners have a `listener` property that stores the real listener // in the EventEmitter that ships with Node.js. // if (event.listener) { if (event.listener.__ultron !== this.id) continue; } else if (event.__ultron !== this.id) { continue; } ee.removeListener(args[i], event); } } return this; }; /** * Destroy the Ultron instance, remove all listeners and release all references. * * @returns {Boolean} * @api public */ Ultron.prototype.destroy = function destroy() { if (!this.ee) return false; this.remove(); this.ee = null; return true; }; // // Expose the module. // module.exports = Ultron;