!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 

uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 

uid=33(www-data) gid=33(www-data) groups=33(www-data) 

Safe-mode: OFF (not secure)

/var/www/html/queuepro/node_modules/ev-emitter/test/   drwxrwxr-x
Free 13.17 GB of 57.97 GB (22.71%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     test.js (3.83 KB)      -rwxrwxr-x
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
/* jshint node: true, unused: true, undef: true */
/* globals it */

var assert = require('assert');
var EvEmitter = require('../ev-emitter');

it( 'should emitEvent', function() {
  var emitter = new EvEmitter();
  var didPop;
  emitter.on( 'pop', function() {
    didPop = true;
  });
  emitter.emitEvent( 'pop' );
  assert.ok( didPop, 'event emitted' );
});

it( 'emitEvent should pass argument to listener', function() {
  var emitter = new EvEmitter();
  var result;
  function onPop( arg ) {
    result = arg;
  }
  emitter.on( 'pop', onPop );
  emitter.emitEvent( 'pop', [ 1 ] );
  assert.equal( result, 1, 'event emitted, arg passed' );
});

it( 'does not allow same listener to be added', function() {
  var emitter = new EvEmitter();
  var ticks = 0;
  function onPop() {
    ticks++;
  }
  emitter.on( 'pop', onPop );
  emitter.on( 'pop', onPop );
  var _onPop = onPop;
  emitter.on( 'pop', _onPop );

  emitter.emitEvent('pop');
  assert.equal( ticks, 1, '1 tick for same listener' );
});

it( 'should remove listener with .off()', function() {
  var emitter = new EvEmitter();
  var ticks = 0;
  function onPop() {
    ticks++;
  }
  emitter.on( 'pop', onPop );
  emitter.emitEvent('pop');
  emitter.off( 'pop', onPop );
  emitter.emitEvent('pop');
  assert.equal( ticks, 1, '.off() removed listener' );

  // reset
  var ary = [];
  ticks = 0;
  emitter.allOff();

  function onPopA() {
    ticks++;
    ary.push('a');
    if ( ticks == 2 ) {
      emitter.off( 'pop', onPopA );
    }
  }
  function onPopB() {
    ary.push('b');
  }

  emitter.on( 'pop', onPopA );
  emitter.on( 'pop', onPopB );
  emitter.emitEvent('pop'); // a,b
  emitter.emitEvent('pop'); // a,b - remove onPopA
  emitter.emitEvent('pop'); // b

  assert.equal( ary.join(','), 'a,b,a,b,b', '.off in listener does not interfer' );

});

it( 'should handle once()', function() {
  var emitter = new EvEmitter();
  var ary = [];

  emitter.on( 'pop', function() {
    ary.push('a');
  });
  emitter.once( 'pop', function() {
    ary.push('b');
  });
  emitter.on( 'pop', function() {
    ary.push('c');
  });
  emitter.emitEvent('pop');
  emitter.emitEvent('pop');

  assert.equal( ary.join(','), 'a,b,c,a,c', 'once listener triggered once' );

  // reset
  emitter.allOff();
  ary = [];

  // add two identical but not === listeners, only do one once
  emitter.on( 'pop', function() {
    ary.push('a');
  });
  emitter.once( 'pop', function() {
    ary.push('a');
  });
  emitter.emitEvent('pop');
  emitter.emitEvent('pop');

  assert.equal( ary.join(','), 'a,a,a', 'identical listeners do not interfere with once' );

});

it( 'does not infinite loop in once()', function() {
  var emitter = new EvEmitter();
  var ticks = 0;
  function onPop() {
    ticks++;
    if ( ticks < 4 ) {
      emitter.emitEvent('pop');
    }
  }

  emitter.once( 'pop', onPop );
  emitter.emitEvent('pop');
  assert.equal( ticks, 1, '1 tick with emitEvent in once' );
});

it( 'handles emitEvent with no listeners', function() {
  var emitter = new EvEmitter();
  assert.doesNotThrow( function() {
    emitter.emitEvent( 'pop', [ 1, 2, 3 ] );
  });

  function onPop() {}

  emitter.on( 'pop', onPop );
  emitter.off( 'pop', onPop );

  assert.doesNotThrow( function() {
    emitter.emitEvent( 'pop', [ 1, 2, 3 ] );
  });

  emitter.on( 'pop', onPop );
  emitter.emitEvent( 'pop', [ 1, 2, 3 ] );
  emitter.off( 'pop', onPop );

  assert.doesNotThrow( function() {
    emitter.emitEvent( 'pop', [ 1, 2, 3 ] );
  });
});


it( 'removes all listeners after allOff', function() {
  var emitter = new EvEmitter();
  var ary = [];
  emitter.on( 'pop', function() {
    ary.push('a');
  });
  emitter.on( 'pop', function() {
    ary.push('b');
  });
  emitter.once( 'pop', function() {
    ary.push('c');
  });

  emitter.emitEvent('pop');
  emitter.allOff();
  emitter.emitEvent('pop');

  assert.equal( ary.join(','), 'a,b,c', 'allOff removed listeners' );
});

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0042 ]--