%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream
'use strict'; const common = require('../common'); const assert = require('assert'); const { AsyncResource, executionAsyncId } = require('async_hooks'); const fn = common.mustCall(AsyncResource.bind(() => { return executionAsyncId(); })); setImmediate(() => { const asyncId = executionAsyncId(); assert.notStrictEqual(asyncId, fn()); }); const asyncResource = new AsyncResource('test'); [1, false, '', {}, []].forEach((i) => { assert.throws(() => asyncResource.bind(i), { code: 'ERR_INVALID_ARG_TYPE' }); }); const fn2 = asyncResource.bind((a, b) => { return executionAsyncId(); }); assert.strictEqual(fn2.asyncResource, asyncResource); assert.strictEqual(fn2.length, 2); setImmediate(() => { const asyncId = executionAsyncId(); assert.strictEqual(asyncResource.asyncId(), fn2()); assert.notStrictEqual(asyncId, fn2()); }); const foo = {}; const fn3 = asyncResource.bind(common.mustCall(function() { assert.strictEqual(this, foo); }), foo); fn3(); const fn4 = asyncResource.bind(common.mustCall(function() { assert.strictEqual(this, undefined); })); fn4(); const fn5 = asyncResource.bind(common.mustCall(function() { assert.strictEqual(this, false); }), false); fn5(); const fn6 = asyncResource.bind(common.mustCall(function() { assert.strictEqual(this, 'test'); })); fn6.call('test');