UNPKG

interruptor

Version:

Run a function with the possibility to interrupt it from another thread

28 lines 689 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.runInterruptible = runInterruptible; exports.interrupt = interrupt; function load() { try { return require('../build/Release/interruptor.node'); } catch { try { return require('../build/Debug/interruptor.node'); } catch (error) { throw error; } } } const native = load(); function runInterruptible(fn) { return native.runInterruptible((index) => { return fn({ __id: index }); }); } function interrupt(handle) { native.interrupt(handle.__id); process.memoryUsage(); } //# sourceMappingURL=index.js.map