Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'use strict';
- var asyncWrap = process.binding('async_wrap');
- var fs = require('fs');
- var asyncHooksObject = {};
- var kCallInitHook = 0;
- asyncHooksObject[kCallInitHook] = 1;
- //asyncHooksObject = new Uint8Array([1]);
- //asyncHooksObject = new Buffer([1]);
- asyncWrap.setupHooks(asyncHooksObject, init, before, after);
- function init() {
- writeSync(JSON.stringify(arguments));
- writeSync('Init called');
- }
- function before() {
- writeSync(JSON.stringify(arguments));
- writeSync('Before called');
- }
- function after() {
- writeSync(JSON.stringify(arguments));
- writeSync('After called');
- }
- setTimeout(function () {
- writeSync('Callback called');
- }, 15);
- function writeSync(text) {
- fs.writeSync(1, text + '\n');
- fs.fsyncSync(1);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement