MCPcopy Create free account
hub / github.com/deepclause/agentvm / withTimeout

Function withTimeout

test/basic.test.js:3–8  ·  view source on GitHub ↗
(promise, ms = 5000)

Source from the content-addressed store, hash-verified

1const { AgentVM } = require('../src/index');
2
3function withTimeout(promise, ms = 5000) {
4 return Promise.race([
5 promise,
6 new Promise((_, reject) => setTimeout(() => reject(new Error(`Timeout after ${ms}ms`)), ms))
7 ]);
8}
9
10async function test() {
11 console.log("Initializing AgentVM...");

Callers 1

testFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected